[LNT] r374685 - [LNT] NFC: Fix order of globals and locals on exec
Hubert Tong via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 12 13:23:16 PDT 2019
Author: hubert.reinterpretcast
Date: Sat Oct 12 13:23:16 2019
New Revision: 374685
URL: http://llvm.org/viewvc/llvm-project?rev=374685&view=rev
Log:
[LNT] NFC: Fix order of globals and locals on exec
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.
Reviewers: cmatthews, thopre, kristof.beyls
Reviewed By: thopre
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D68903
Modified:
lnt/trunk/lnt/tests/nt.py
Modified: lnt/trunk/lnt/tests/nt.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/tests/nt.py?rev=374685&r1=374684&r2=374685&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/nt.py (original)
+++ lnt/trunk/lnt/tests/nt.py Sat Oct 12 13:23:16 2019
@@ -536,7 +536,7 @@ def execute_test_modules(test_log, test_
results = []
for name in test_modules:
# First, load the test module file.
- locals = globals = {}
+ globals = {}
test_path = os.path.join(config.test_suite_root, 'LNTBased', name)
# This is where shared code between test modules should go.
sys.path.append(os.path.join(config.test_suite_root, 'LNTBased/lib'))
@@ -544,7 +544,7 @@ def execute_test_modules(test_log, test_
module_path = os.path.join(test_path, 'TestModule')
module_file = open(module_path)
try:
- exec(module_file, locals, globals)
+ exec(module_file, globals)
except Exception:
info = traceback.format_exc()
fatal("unable to import test module: %r\n%s" % (
More information about the llvm-commits
mailing list