New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression fix_imports does not refactor multiple imports correctly #48914
Comments
If you have urlparse before cStringIO in an import line, 2to3 will not So this file: will with 2to3 return the following diff: --- test3.py (original)
+++ test3.py (refactored)
@@ -1,3 +1,3 @@
-import urlparse, cStringIO
-import cStringIO, urlparse
+import urllib.parse, cStringIO
+import io, urlparse |
Sorry, I still cannot reproduce it. Could you attach your test file? alex@helios:~$ 2to3 -f imports test.py
--- test.py (original)
+++ test.py (refactored)
@@ -1,2 +1,2 @@
-import urlparse, cStringIO
-import cStringIO, urlparse
+import urllib.parse, io
+import io, urllib.parse
RefactoringTool: Files that need to be modified:
RefactoringTool: test.py |
Here's one which doesn't work correctly: $ 2to3 -
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
import cStringIO, HTMLParser
--- <stdin> (original)
+++ <stdin> (refactored)
@@ -1,1 +1,1 @@
-import cStringIO, HTMLParser
+import io, HTMLParser
RefactoringTool: Files that need to be modified:
RefactoringTool: <stdin> This is because the fix_imports pattern catching one module per import |
Heres my test file. |
Benjamin, your example fails for a different reason--i.e. the fixer for Sorry Lennart, I still cannot reproduce it. |
What version are you running? Can you post the output? |
I got it. It is a regression from a previous version of 2to3's And to answer your question, I still running an older RC release of $ python3.0 -c "import sys; print(sys.version)"
3.0rc2+ (py3k:67237, Nov 16 2008, 15:10:03)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] |
Fixed in r67774. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: