Author flashk
Recipients flashk
Date 2009-11-06.00:08:53
SpamBayes Score 3.28305e-07
Marked as misclassified No
Message-id <1257466136.74.0.490341354872.issue7268@psf.upfronthosting.co.za>
In-reply-to
Content
I recently ran 2to3 on some of my scripts and noticed a change in behavior.

I had a script that used the built-in execfile function. After the conversion, it was 
changed to manually open the file and read the contents into the exec function. Now I am 
getting a SyntaxError with the modified code.

The SyntaxError is caused when the new exec code is called on a script that ends with an 
empty indented line. I'm not sure if this is an error with the 2to3 script or the built-
in exec function.

I've attached a very minimal test case. The test.py file is a simple hello world script 
that ends with an empty indented line. The execfile_example.py file simply calls 
execfile on the test.py script. The execfile_example_converted.py file is the 2to3 
converted version of execfile_example.py.

I'm running Python 2.6.2 on Windows XP.
History
Date User Action Args
2009-11-06 00:08:56flashksetrecipients: + flashk
2009-11-06 00:08:56flashksetmessageid: <1257466136.74.0.490341354872.issue7268@psf.upfronthosting.co.za>
2009-11-06 00:08:55flashklinkissue7268 messages
2009-11-06 00:08:54flashkcreate