[issue14282] lib2to3.fixer_util.touch_import('__future__', ...) can lead to SyntaxError in code

2012-03-13 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: I think that's actually a bug in python-modernize, not in touch_import - or, rather, touch_import shouldn't be used to add future imports. Instead, I think there should be a touch_future function which adds a future import, taking into

[issue14282] lib2to3.fixer_util.touch_import('__future__', ...) can lead to SyntaxError in code

2012-03-13 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Instead of changing touch_import, I propose to add a function similar to https://github.com/loewis/python-modernize/commit/0db885e616807d0cc6859b4035d81fd260b06a67 -- ___ Python tracker

[issue14282] lib2to3.fixer_util.touch_import('__future__', ...) can lead to SyntaxError in code

2012-03-13 Thread Luke Macken
Luke Macken lmac...@redhat.com added the comment: Yep, that seems like the right solution. Thanks, Martin. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14282 ___

[issue14282] lib2to3.fixer_util.touch_import('__future__', ...) can lead to SyntaxError in code

2012-03-13 Thread Benjamin Peterson
Changes by Benjamin Peterson benja...@python.org: -- resolution: - works for me status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14282 ___

[issue14282] lib2to3.fixer_util.touch_import('__future__', ...) can lead to SyntaxError in code

2012-03-12 Thread Luke Macken
New submission from Luke Macken lmac...@redhat.com: Problem: lib2to3.fixer_util.touch_import('__future__', ...) will insert the import statement below all other imports. This will then trigger the following error: SyntaxError: from __future__ imports must occur at the beginning of the

[issue14282] lib2to3.fixer_util.touch_import('__future__', ...) can lead to SyntaxError in code

2012-03-12 Thread Luke Macken
Changes by Luke Macken lmac...@redhat.com: -- keywords: +patch Added file: http://bugs.python.org/file24814/python-lib2to3-touch-future-import.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14282