Author smarnach
Recipients smarnach
Date 2011-11-03.12:11:31
SpamBayes Score 1.89557e-10
Marked as misclassified No
Message-id <>
The execfile fixer of the 2to3 script replaces the 2.x code



    exec(compile(open("").read(), "", 'exec'))

The new code does not explicitly close the file.  This is not usually a problem in CPython, but

 1. the code will throw a RessourceWarnings if enabled and

 2. other Python implementation don't close the file immediately.

(I think the 2to3 script should be as implementation-independent as possible.)

The obvious fix would be to use a with-statement:

    with open("") as new_name:
        exec(compile(, "", 'exec'))

If this is to be changed, I'd be happy to prepare a patch.
Date User Action Args
2011-11-03 12:11:32smarnachsetrecipients: + smarnach
2011-11-03 12:11:32smarnachsetmessageid: <>
2011-11-03 12:11:31smarnachlinkissue13332 messages
2011-11-03 12:11:31smarnachcreate