aboutsummaryrefslogtreecommitdiff
path: root/python/stepA_more.py
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-16 22:42:17 -0500
committerJoel Martin <github@martintribe.org>2014-04-16 22:42:17 -0500
commita05f7822b10ed4cdd61ed8384299a003baf1c1c6 (patch)
tree28ec9e0efa0cb5c7f335579271c61a2f910680f9 /python/stepA_more.py
parentb3402a82d38d0d59b91b117005c6bef2748acf8b (diff)
downloadmal-a05f7822b10ed4cdd61ed8384299a003baf1c1c6.tar.gz
mal-a05f7822b10ed4cdd61ed8384299a003baf1c1c6.zip
Python: metadata on builtin funcs. Support python3.
Diffstat (limited to 'python/stepA_more.py')
-rw-r--r--python/stepA_more.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/python/stepA_more.py b/python/stepA_more.py
index 21c1641..dccce8e 100644
--- a/python/stepA_more.py
+++ b/python/stepA_more.py
@@ -89,7 +89,10 @@ def EVAL(ast, env):
elif 'macroexpand' == a0:
return macroexpand(ast[1], env)
elif "py!*" == a0:
- exec compile(ast[1], '', 'single') in globals()
+ if sys.version_info[0] >= 3:
+ exec(compile(ast[1], '', 'single'), globals())
+ else:
+ exec(compile(ast[1], '', 'single') in globals())
return None
elif "py*" == a0:
return eval(ast[1])
@@ -103,7 +106,7 @@ def EVAL(ast, env):
try:
return EVAL(a1, env);
except Exception as exc:
- exc = exc.message
+ exc = exc.args[0]
catch_env = Env(env, [a2[1]], [exc])
return EVAL(a2[2], catch_env)
else:
@@ -168,4 +171,4 @@ else:
print(REP(line))
except reader.Blank: continue
except Exception as e:
- print "".join(traceback.format_exception(*sys.exc_info()))
+ print("".join(traceback.format_exception(*sys.exc_info())))