Issue12873
Created on 2011-08-31 21:57 by Arfrever, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg143283 - (view) | Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * ![]() |
Date: 2011-08-31 21:57 | |
$ 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
|
|||
| msg143418 - (view) | Author: Éric Araujo (eric.araujo) * ![]() |
Date: 2011-09-02 17:06 | |
I don’t understand what the bug is. |
|||
| msg143425 - (view) | Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * ![]() |
Date: 2011-09-02 17:52 | |
If import from __future__ is written in multiple lines, then a parser internally used by 2to3 recognizes only the first line. (However Python interpreter properly supports multi-line imports from __future__.) test1.py contains multi-line import from __future__. test2.py contains single-line import from __future__. 2to3 properly handles test2.py and improperly handles test1.py. |
|||
| msg143429 - (view) | Author: (lunaryorn) | Date: 2011-09-02 18:21 | |
More precisely, the bug is, that 2to3 refactors the "print()" invocation in "test1.py" though it shouldn't because a "print_function" future import is present at the beginning of "test1.py". The cross-check with "test2.py" shows that this is due to the multi-line future import in "test1.py" because the line-break in the import statement is the only difference between both files. |
|||
| msg253129 - (view) | Author: Jos de Kloe (jdekloe) | Date: 2015-10-17 14:33 | |
still having this issue with 2to3 from python-tools-2.7.8-11 as packaged by Fedora 21. Any progress since 2011? |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:21 | admin | set | github: 57082 |
| 2021-10-20 22:46:23 | iritkatriel | set | status: open -> closed superseder: Close 2to3 issues and list them here resolution: wont fix stage: resolved |
| 2015-10-17 14:33:28 | jdekloe | set | nosy:
+ jdekloe messages: + msg253129 |
| 2011-09-02 18:21:01 | lunaryorn | set | messages: + msg143429 |
| 2011-09-02 17:52:25 | Arfrever | set | messages: + msg143425 |
| 2011-09-02 17:06:42 | eric.araujo | set | nosy:
+ eric.araujo messages: + msg143418 |
| 2011-09-01 11:38:03 | lunaryorn | set | nosy:
+ lunaryorn |
| 2011-08-31 21:57:20 | Arfrever | create | |

