summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-01-13 22:10:41 (GMT)
committerGuido van Rossum <guido@python.org>2001-01-13 22:10:41 (GMT)
commit4ec59c75e30e31e9b3e9b90f66d86d8a08a1f846 (patch)
treee5f2d7baf90a830823dc4cb8fffd714ea251d830
parent03df3b3bc1073c43ae36777b8f5c3646b9cce61d (diff)
downloadcpython-4ec59c75e30e31e9b3e9b90f66d86d8a08a1f846.zip
cpython-4ec59c75e30e31e9b3e9b90f66d86d8a08a1f846.tar.gz
cpython-4ec59c75e30e31e9b3e9b90f66d86d8a08a1f846.tar.bz2
SF Patch #103227 by mwh: make code.py appreciate softspace
-rw-r--r--Lib/code.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/code.py b/Lib/code.py
index 9ef6322..b308a58 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.