aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Tong <hubert.reinterpretcast@gmail.com>2019-10-12 20:23:16 +0000
committerHubert Tong <hubert.reinterpretcast@gmail.com>2019-10-12 20:23:16 +0000
commit386ea9712d8067f8c974048355c05fda0c29ad80 (patch)
treeba7f7eefe6f5cbd4c859d9a2b6b00eced8517a83
parent48a115b4b72b9079bba86f34e22996dc222c88e1 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/lnt/trunk@374685 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lnt/tests/nt.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lnt/tests/nt.py b/lnt/tests/nt.py
index cf4d634..fd0efac 100644
--- a/lnt/tests/nt.py
+++ b/lnt/tests/nt.py
@@ -536,7 +536,7 @@ def execute_test_modules(test_log, test_modules, test_module_variables,
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_modules, test_module_variables,
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" % (