STINNER Victor <[email protected]> added the comment:
The bug is specific to compile(), the import machinery supports Windows
newlines on Linux for example.
marge$ python2.6
Type "help", "copyright", "credits" or "license" for more information.
>>> code=open("win.py", "rb").read()
>>> exec compile(code, "win.py", "exec")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "win.py", line 1
print("line 1")
^
SyntaxError: invalid syntax
>>> import imp
>>> win=imp.load_source("win.py")
>>> win=imp.load_source("win.py", "win.py")
line 1
line 2
>>> win
<module 'win.py' from 'win.py'>
>>> import win
line 1
line 2
----------
nosy: +haypo
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue12189>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com