[Python-bugs-list] [Bug #110598] Fwd: Debian Bug#46993: py_compile.compile() won't compile files with CR+LF line endings (PR#101)
Wed, 23 Aug 2000 07:32:08 -0700
Bug #110598, was updated on 2000-Jul-31 21:05
Here is a current snapshot of the bug.
Bug Group: None
Summary: Fwd: Debian Bug#46993: py_compile.compile() won't compile files with CR+LF line endings (PR#101)
Details: Jitterbug-Id: 101
Date: Mon, 11 Oct 1999 15:10:37 +0200
OS: Debian GNU/Linux potato
[This was recorded as Debian bug#46993, cf.
On Unix systems, py_compile.compile() (and therefore compileall.py) won't
compile files with DOS/Windows lineendings (CR+LF). Commands like "import"
or "exec" will work, though.
The problem seems to be that py_compile.compile read()'s the whole file at
once and passes it as a string to __builtin__.compile(), while "import"
calls __builtin__.compile() for a file, so that __builtin__.compile seems to
do some magic while reading the file.
For a quick testcase:
Traceback (innermost last):
File "<stdin>", line 1, in ?
File "<stdin>", line 9, in x
File "<string>", line 1
SyntaxError: invalid syntax
while "import test" works fine and results in test.pyc.
Certainly the file.read() in py_compile.compile() isn't good enough for this
Mon Oct 11 18:12:13 1999 guido moved from incoming to open
For detailed info, follow this link: