aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2018-07-05 17:01:34 +0200
committerArmin Rigo <arigo@tunes.org>2018-07-05 17:01:34 +0200
commitdb9211763f5d6b68913e00fabedfa35212189aa6 (patch)
tree4f848579ab23f7712d9da6a9cab3f48587c750bb /lib-python
parentsys.excepthook() should add a newline to stdout if needed, in addition to flu... (diff)
downloadpypy-db9211763f5d6b68913e00fabedfa35212189aa6.tar.gz
pypy-db9211763f5d6b68913e00fabedfa35212189aa6.tar.bz2
pypy-db9211763f5d6b68913e00fabedfa35212189aa6.zip
Issue #2837
Write an end-of-line and flush stdout when an exception is about to be printed in code.py. Needed to emulate CPython's interactive command line behaviour more closely, and good to avoid strange effects.
Diffstat (limited to 'lib-python')
-rw-r--r--lib-python/2.7/code.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib-python/2.7/code.py b/lib-python/2.7/code.py
index 3b39d1b346..a8290added 100644
--- a/lib-python/2.7/code.py
+++ b/lib-python/2.7/code.py
@@ -104,6 +104,12 @@ class InteractiveInterpreter:
except SystemExit:
raise
except:
+ if softspace(sys.stdout, 0):
+ print
+ try:
+ sys.stdout.flush()
+ except:
+ pass
self.showtraceback()
else:
if softspace(sys.stdout, 0):