[issue7268] 2to3 execfile conversion changes behavior

flashk report at bugs.python.org
Fri Nov 6 04:13:10 CET 2009


flashk <flashk at gmail.com> added the comment:

I noticed that calling "exec('\t')" raises a SyntaxError, so maybe this is 
the root of the problem. I manually added a newline character to the end 
of the file contents and it fixes the issue for me:

exec(compile(open('test.py').read()+'\n', 'test.py', 'exec'))

So maybe the 2to3 script should automatically do this in order to be 
compatible with previous execfile behavior? Or is this a problem with 
exec?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7268>
_______________________________________


More information about the Python-bugs-list mailing list