This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
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) * (Python triager) | 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) * (Python committer) | Date: 2011年09月02日 17:06 | |
I don’t understand what the bug is. |
|||
| msg143425 - (view) | Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) | 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 | |