This is an archive of the discontinued LLVM Phabricator instance.

[LNT] NFC: Fix order of globals and locals on exec
ClosedPublic

Authored by hubert.reinterpretcast on Oct 11 2019, 9:58 PM.

Details

Summary

Per https://docs.python.org/3/library/functions.html#exec, the globals parameter comes before the locals one. Since globals and locals refer to the same object for the call in question, we can remove locals, which will cause the globals parameter to be used for both the global and the local variables, thus keeping the same behavior.

Event Timeline

thopre accepted this revision.Oct 12 2019, 1:50 AM

LGTM but would suggest this altered description:

Per https://docs.python.org/3/library/functions.html#exec, globals parameter comes before locals. Since globals and locals refer to the same object for the call in question, we can remove locals, which will make globals used for both the global and the local variables, thus keeping the same behavior.

This revision is now accepted and ready to land.Oct 12 2019, 1:50 AM
hubert.reinterpretcast edited the summary of this revision. (Show Details)Oct 12 2019, 1:13 PM