This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author fabioz
Recipients fabioz
Date 2008-12-22.11:24:57
SpamBayes Score 0.17994589
Marked as misclassified No
Message-id <1229945098.56.0.809169461336.issue4717@psf.upfronthosting.co.za>
In-reply-to
Content
In 2to3, execfile(file, globals, locals) is translated to 

exec(open(file).read(), globals, locals)

But that's not correct, as the actual file from the executed code gets
wrong with that.

The correct thing would be:

exec(compile(open(file).read(), file, 'exec'), globals, locals)

So that the name of the file remains correct in the module that's being run.
History
Date User Action Args
2008-12-22 11:24:58fabiozsetrecipients: + fabioz
2008-12-22 11:24:58fabiozsetmessageid: <1229945098.56.0.809169461336.issue4717@psf.upfronthosting.co.za>
2008-12-22 11:24:57fabiozlinkissue4717 messages
2008-12-22 11:24:57fabiozcreate