diff options
author | maheshgudi | 2017-01-11 23:46:26 +0530 |
---|---|---|
committer | maheshgudi | 2017-01-11 23:46:26 +0530 |
commit | 987efbcba6e9976d1351a35454a62d6b8305009d (patch) | |
tree | 875e9edaa8bcb7dee8322a63bf84a648a3ba3ee8 /yaksh/hook_evaluator.py | |
parent | db4b15ada4b078910442984776dbfc20e5955a8c (diff) | |
download | online_test-987efbcba6e9976d1351a35454a62d6b8305009d.tar.gz online_test-987efbcba6e9976d1351a35454a62d6b8305009d.tar.bz2 online_test-987efbcba6e9976d1351a35454a62d6b8305009d.zip |
check_answer executed in custom scope instead of globals
Diffstat (limited to 'yaksh/hook_evaluator.py')
-rw-r--r-- | yaksh/hook_evaluator.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/yaksh/hook_evaluator.py b/yaksh/hook_evaluator.py index 891192c..3956da1 100644 --- a/yaksh/hook_evaluator.py +++ b/yaksh/hook_evaluator.py @@ -53,8 +53,10 @@ class HookEvaluator(BaseEvaluator): try: tb = None _tests = compile(self.hook_code, '<string>', mode='exec') - exec(_tests, globals()) - success, err, mark_fraction = check_answer(self.user_answer) + hook_scope = {} + exec(_tests, hook_scope) + check = hook_scope["check_answer"] + success, err, mark_fraction = check(self.user_answer) except TimeoutException: raise except Exception: |