Issue 7861: 2to3: "import foo" -> "from . import foo" (original) (raw)

Issue7861

Created on 2010-02-05 19:37 by tomspur, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg98900 - (view) Author: Thomas Spura (tomspur) Date: 2010-02-05 19:37
My custom setup / testcase for testing the transition "import foo" -> "from . import foo": mkdir -p test/sub touch test/sub/__init__.py touch test/__init__.py cat >> test/__init__.py << EOF import sub EOF cat >> test.py << EOF import test EOF This won't work with python3 so I ran 2to3 on it: $ 2to3 . RefactoringTool: Skipping implicit fixer: buffer RefactoringTool: Skipping implicit fixer: idioms RefactoringTool: Skipping implicit fixer: set_literal RefactoringTool: Skipping implicit fixer: ws_comma RefactoringTool: No files need to be modified. -> Nothing found. Using the python3 version of 2to3: $ python3-2to3 . RefactoringTool: Skipping implicit fixer: buffer RefactoringTool: Skipping implicit fixer: idioms RefactoringTool: Skipping implicit fixer: set_literal RefactoringTool: Skipping implicit fixer: ws_comma RefactoringTool: Refactored ./test/__init__.py --- ./test/__init__.py (original) +++ ./test/__init__.py (refactored) @@ -1,1 +1,1 @@ -import sub +from . import sub RefactoringTool: Files that need to be modified: RefactoringTool: ./test/__init__.py -> python3 version of 2to3 can change it, but Python 2.6.2 is not able to.
msg98903 - (view) Author: Thomas Spura (tomspur) Date: 2010-02-05 19:49
#2446 should be related to this one.
msg98929 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-02-06 02:09
Well, you'll just have to wait for the next version of 2.6 to be released then.
msg99067 - (view) Author: Thomas Spura (tomspur) Date: 2010-02-08 20:31
The commit I'm talking about was 22 months ago (r61755), python 2.6.2 was released April 14, 2009. At least strange, that this is not jet in there, but if you think, it will in the next version...
History
Date User Action Args
2022-04-11 14:56:57 admin set github: 52109
2010-02-08 20:31:50 tomspur set messages: +
2010-02-06 02:09:17 benjamin.peterson set status: open -> closedresolution: out of datemessages: +
2010-02-05 20:00:39 dmalcolm set nosy: + dmalcolm
2010-02-05 19:49:00 tomspur set nosy: + wolevermessages: +
2010-02-05 19:41:04 ezio.melotti set priority: normalnosy: + mark.dickinson, benjamin.peterson, ezio.melottitype: compile error -> enhancementstage: needs patch
2010-02-05 19:37:30 tomspur create