[issue13332] execfile fixer produces code that does not close the file

2021-10-20 Thread Irit Katriel
Change by Irit Katriel : -- resolution: duplicate -> wont fix ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue13332] execfile fixer produces code that does not close the file

2021-10-20 Thread Irit Katriel
Change by Irit Katriel : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Close 2to3 issues and list them here ___ Python tracker ___ ___

[issue13332] execfile fixer produces code that does not close the file

2011-11-03 Thread Aaron Meurer
Changes by Aaron Meurer : -- nosy: +Aaron.Meurer ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue13332] execfile fixer produces code that does not close the file

2011-11-03 Thread Vlada Peric
Changes by Vlada Peric : -- nosy: +VPeric ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.or

[issue13332] execfile fixer produces code that does not close the file

2011-11-03 Thread Benjamin Peterson
Benjamin Peterson added the comment: Or you could just explicitly write out the exec(compile()) in your 2.x code. -- ___ Python tracker ___ _

[issue13332] execfile fixer produces code that does not close the file

2011-11-03 Thread Sven Marnach
Sven Marnach added the comment: Getting the general case right seems a bit too difficult. Examples like [execfile(n) for n in names if condition(n)] execfile(execfile(n1) or n2) try: 1 / 0 except execfile(n) or ZeroDivisionError: pass would require rather complex transformat

[issue13332] execfile fixer produces code that does not close the file

2011-11-03 Thread Sven Marnach
Sven Marnach added the comment: @Petri: Yes, that's what the BaseFix.new_name() method is for. @Antoine: I thought about this, though I don't think it is very common to call execfile() as part of an expression. The whole statement containing the function call would need to be wrapped. --

[issue13332] execfile fixer produces code that does not close the file

2011-11-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: Be aware that execfile() is a simple function call and can be used in any expression. -- nosy: +benjamin.peterson, pitrou ___ Python tracker _

[issue13332] execfile fixer produces code that does not close the file

2011-11-03 Thread Petri Lehtinen
Petri Lehtinen added the comment: Sounds reasonable to me. Is it easy to generate unique identifier names in 2to3 fixers? -- nosy: +petri.lehtinen ___ Python tracker ___ __

[issue13332] execfile fixer produces code that does not close the file

2011-11-03 Thread Sven Marnach
New submission from Sven Marnach : The execfile fixer of the 2to3 script replaces the 2.x code execfile("a.py") by exec(compile(open("a.py").read(), "a.py", 'exec')) The new code does not explicitly close the file. This is not usually a problem in CPython, but 1. the code will thr