diff options
author | Armin Rigo <arigo@tunes.org> | 2018-07-05 17:01:34 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2018-07-05 17:01:34 +0200 |
commit | db9211763f5d6b68913e00fabedfa35212189aa6 (patch) | |
tree | 4f848579ab23f7712d9da6a9cab3f48587c750bb /lib-python | |
parent | sys.excepthook() should add a newline to stdout if needed, in addition to flu... (diff) | |
download | pypy-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.py | 6 |
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): |