[Python-checkins] CVS: python/dist/src/Lib py_compile.py,1.15,1.16
Martin v. Löwis
python-dev@python.org
Thu, 14 Sep 2000 23:57:29 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv3459
Modified Files:
py_compile.py
Log Message:
Support \r in source files. Closes bug #101425.
Index: py_compile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/py_compile.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** py_compile.py 2000/02/04 15:10:34 1.15
--- py_compile.py 2000/09/15 06:57:26 1.16
***************
*** 49,52 ****
--- 49,57 ----
timestamp = long(os.stat(file)[8])
codestring = f.read()
+ # If parsing from a string, line breaks are \n (see parsetok.c:tok_nextc)
+ # Replace will return original string if pattern is not found, so
+ # we don't need to check whether it is found first.
+ codestring = codestring.replace("\r\n","\n")
+ codestring = codestring.replace("\r","\n")
f.close()
if codestring and codestring[-1] != '\n':