Skip to content
Snippets Groups Projects
Unverified Commit 27aa7e4a authored by Ayub's avatar Ayub Committed by GitHub
Browse files

Merge pull request #21806 from edx/BOM-609

BOM-609
parents f4ca2035 b5dc95a3
No related merge requests found
......@@ -117,7 +117,7 @@ def safe_exec(
if cache:
safe_globals = json_safe(globals_dict)
md5er = hashlib.md5()
md5er.update(six.b(repr(code)))
md5er.update(repr(code).encode('utf-8'))
update_hash(md5er, safe_globals)
key = "safe_exec.%r.%s" % (random_seed, md5er.hexdigest())
cached = cache.get(key)
......@@ -146,6 +146,8 @@ def safe_exec(
python_path=python_path, extra_files=extra_files, slug=slug,
)
except SafeExecException as e:
# Saving SafeExecException e in exception to be used later.
exception = e
emsg = text_type(e)
else:
emsg = None
......@@ -158,4 +160,4 @@ def safe_exec(
# If an exception happened, raise it now.
if emsg:
raise e
raise exception
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment