From 4ec59c75e30e31e9b3e9b90f66d86d8a08a1f846 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sat, 13 Jan 2001 22:10:41 +0000 Subject: [PATCH] SF Patch #103227 by mwh: make code.py appreciate softspace --- Lib/code.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Lib/code.py b/Lib/code.py index 9ef6322731..b308a5807c 100644 --- a/Lib/code.py +++ b/Lib/code.py @@ -10,6 +10,17 @@ import string import traceback from codeop import compile_command +def softspace(file, newvalue): + oldvalue = 0 + try: + oldvalue = file.softspace + except AttributeError: + pass + try: + file.softspace = newvalue + except TypeError: # "attribute-less object" or "read-only attributes" + pass + return oldvalue class InteractiveInterpreter: """Base class for InteractiveConsole. @@ -90,6 +101,9 @@ class InteractiveInterpreter: raise except: self.showtraceback() + else: + if softspace(sys.stdout, 0): + print def showsyntaxerror(self, filename=None): """Display the syntax error that just occurred. -- 2.50.1