[Python-checkins] CVS: python/dist/src/Lib code.py,1.10,1.11
Guido van Rossum
python-dev@python.org
Sat, 13 Jan 2001 14:10:43 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv11338
Modified Files:
code.py
Log Message:
SF Patch #103227 by mwh: make code.py appreciate softspace
Index: code.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/code.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** code.py 2000/12/27 19:12:58 1.10
--- code.py 2001/01/13 22:10:41 1.11
***************
*** 11,14 ****
--- 11,25 ----
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:
***************
*** 91,94 ****
--- 102,108 ----
except:
self.showtraceback()
+ else:
+ if softspace(sys.stdout, 0):
+ print
def showsyntaxerror(self, filename=None):