summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authormaheshgudi2017-01-11 23:46:26 +0530
committermaheshgudi2017-01-11 23:46:26 +0530
commit987efbcba6e9976d1351a35454a62d6b8305009d (patch)
tree875e9edaa8bcb7dee8322a63bf84a648a3ba3ee8 /yaksh
parentdb4b15ada4b078910442984776dbfc20e5955a8c (diff)
downloadonline_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')
-rw-r--r--yaksh/hook_evaluator.py6
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: