[issue7268] 2to3 execfile conversion changes behavior
Gabriel Genellina
report at bugs.python.org
Sat Nov 7 07:14:46 CET 2009
Gabriel Genellina <gagsl-py2 at yahoo.com.ar> added the comment:
The docs for the built-in function compile() say:
"Note: When compiling a string with multi-line statements, line endings
must be represented by a single newline character ('\n'), and the input
must be terminated by at least one newline character. If line endings
are represented by '\r\n', use str.replace() to change them into '\n'."
http://www.python.org/doc/3.1/library/functions.html#compile
And the standard module py_compile ensures the source text ends with
'\n' before calling the built-in compile function:
if codestring and codestring[-1] != '\n':
codestring = codestring + '\n'
I'd say the corresponding 2to3 fixer should do the same.
----------
nosy: +gagenellina
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7268>
_______________________________________
More information about the Python-bugs-list
mailing list