From 2f9a24b250bb8f457765a3b2ac621a4176953f74 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sat, 10 Oct 2015 17:21:42 +0200 Subject: Use a selector instead of polling Python interpreter --- python/runner/interpreter.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'python/runner') 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() -- cgit v1.2.1