New submission from flashk <fla...@gmail.com>: 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. ---------- components: 2to3 (2.x to 3.0 conversion tool), Interpreter Core files: execfile_problem.zip messages: 94949 nosy: flashk severity: normal status: open title: 2to3 execfile conversion changes behavior type: behavior versions: Python 2.6 Added file: http://bugs.python.org/file15267/execfile_problem.zip _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7268> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com