You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2007-08-23.20:15:47.807>created_at=<Date2004-03-28.06:40:13.000>labels= ['library']
title='work around to compile \\r\\n file'updated_at=<Date2007-08-23.20:15:47.805>user='https://bugs.python.org/quiver'
On Unix-like systems, built-in function compile cannot
compile files that don't use linefeed as an EOL. But there
are several codes in the library which assume that input
files use valid EOL characters.
So when they come across \r\n(or \r) on Unix
environments, compile causes the parser to raise a
SyntaxError.
For example:
>>> list(file('a.py'))
['\r\n']
>>> import trace
>>> trace.find_executable_linenos('a.py')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.3/trace.py", line 389, in
find_executable_linenos
code = compile(prog, filename, "exec")
File "a.py", line 1
^
SyntaxError: invalid syntax
Lib/py_compile.py opens files with 'U' option to handle
file format differences and I think this is the way to go.
There is one drawback.
When Python is configured without universal newline
support, this approach doesn't work :-(
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: