aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jesopo2018-10-12 13:18:06 +0100
committerGravatar jesopo2018-10-12 13:18:06 +0100
commitc66b376e7f7bea27ef2d46b84de560ff49c37de2 (patch)
tree8c86db6637f3bcf6cf657c390d175f1eb4969db5
parentAdd a \n between potential prints in eval() and printing the return from eval so (diff)
signature
Use compile+eval to support statements and expressions
-rw-r--r--modules/eval_python.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/eval_python.py b/modules/eval_python.py
index bf5cd5ec..07a09297 100644
--- a/modules/eval_python.py
+++ b/modules/eval_python.py
@@ -3,7 +3,8 @@ from src import ModuleManager, utils
EVAL_TEMPLATE = """
import sys
-result = eval(sys.stdin.read())
+compiled = compile(sys.stdin.read(), 'code', 'single')
+result = eval(compiled)
print("")
if not result == None:
sys.stdout.write(str(result))