[issue12873] 2to3 incorrectly handles multi-line imports from __future__

Arfrever Frehtes Taifersar Arahesis report at bugs.python.org
Wed Aug 31 23:57:21 CEST 2011


New submission from Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA at GMail.Com>:

$ cat test1.py
from __future__ import (absolute_import, division,
    print_function, unicode_literals)

print(1, 2)
$ cat test2.py
from __future__ import (absolute_import, division, print_function, unicode_literals)

print(1, 2)
$ python2.7 -c 'import test1'
1 2
$ python2.7 -c 'import test2'
1 2
$ 2to3 test1.py test2.py
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Refactored test1.py
--- test1.py    (original)
+++ test1.py    (refactored)
@@ -1,4 +1,4 @@
 from __future__ import (absolute_import, division,
     print_function, unicode_literals)
 
-print(1, 2)
+print((1, 2))
RefactoringTool: Files that need to be modified:
RefactoringTool: test1.py

----------
components: 2to3 (2.x to 3.0 conversion tool)
messages: 143283
nosy: Arfrever, benjamin.peterson
priority: normal
severity: normal
status: open
title: 2to3 incorrectly handles multi-line imports from __future__
versions: Python 2.7, Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12873>
_______________________________________


More information about the Python-bugs-list mailing list