summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2015-10-10 17:21:42 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2015-10-10 17:21:42 +0200
commit2f9a24b250bb8f457765a3b2ac621a4176953f74 (patch)
treec85d34e454e7718b34476b03952627d7ae2e139d /python
parent0c45b02bdbb1e4be10aa82422f419d3cc4bbe7c9 (diff)
Use a selector instead of polling Python interpreter
Diffstat (limited to 'python')
-rwxr-xr-xpython/runner/interpreter.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/python/runner/interpreter.py b/python/runner/interpreter.py
index 5d8dc09..da60d72 100755
--- a/python/runner/interpreter.py
+++ b/python/runner/interpreter.py
@@ -71,6 +71,8 @@ class MyConsole(code.InteractiveConsole):
prompt = '>>> '
buffer = []
self.write('\n')
+ except ValueError:
+ break
except EOFError:
break
@@ -78,10 +80,12 @@ class MyConsole(code.InteractiveConsole):
try:
exec(code, self.locals)
except KeyboardInterrupt:
- # Don't show traceback on SIGINT.
self.write('^C')
raise
+ except SystemExit as ex:
+ raise
except:
+ # Show traceback for all other exceptions.
self.showtraceback()
MyConsole().interact()