diff options
author | Guido van Rossum <guido@python.org> | 2001-01-13 22:10:41 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-01-13 22:10:41 +0000 |
commit | cf0b7e82ecbcbb7bd904ad0c8dd5757f31dcf97f (patch) | |
tree | 967f5db7fe5a364c9ae07d05d95e8f9ce66f52db /Lib/code.py | |
parent | eb7afb7c1becd20d128c10e98a83dd3837c44cff (diff) | |
download | cpython-cf0b7e82ecbcbb7bd904ad0c8dd5757f31dcf97f.tar.gz |
SF Patch #103227 by mwh: make code.py appreciate softspace
Diffstat (limited to 'Lib/code.py')
-rw-r--r-- | Lib/code.py | 14 |
1 files changed, 14 insertions, 0 deletions
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. |