Kaydet (Commit) ff1ce0f4 authored tarafından Martin v. Löwis's avatar Martin v. Löwis

Support \r in source files. Closes bug #101425.

üst d2a5ad25
...@@ -48,6 +48,11 @@ def compile(file, cfile=None, dfile=None): ...@@ -48,6 +48,11 @@ def compile(file, cfile=None, dfile=None):
except AttributeError: except AttributeError:
timestamp = long(os.stat(file)[8]) timestamp = long(os.stat(file)[8])
codestring = f.read() 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() f.close()
if codestring and codestring[-1] != '\n': if codestring and codestring[-1] != '\n':
codestring = codestring + '\n' codestring = codestring + '\n'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment