summaryrefslogtreecommitdiff
path: root/kpov_judge/instructions_extractor.py
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-05 18:04:45 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-05 18:04:45 +0200
commit772532d87cc97828d1e29c0ca91f50112f5a6ede (patch)
tree23cb1188889cd115c525cc3fe83a3a0adb332cac /kpov_judge/instructions_extractor.py
parentc54584bf5ae0b4973464da1e033c6628b82e9cd5 (diff)
Pass globals() to exec calls
Diffstat (limited to 'kpov_judge/instructions_extractor.py')
-rw-r--r--kpov_judge/instructions_extractor.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/kpov_judge/instructions_extractor.py b/kpov_judge/instructions_extractor.py
index b1644b2..f747c1a 100644
--- a/kpov_judge/instructions_extractor.py
+++ b/kpov_judge/instructions_extractor.py
@@ -22,8 +22,9 @@ def print_instructions(p, fname):
print(" - ".join(l1))
with open(os.path.join(p, fname)) as f:
task_code = compile(f.read(), fname, 'exec')
- exec(task_code)
- for lang, text in instructions.items():
+ d = {}
+ exec(task_code, globals(), d)
+ for lang, text in d['instructions'].items():
print("Language: {0}".format(lang))
print(text.encode('utf-8'))
print("")