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.

classification
Title: 2to3: imports fixer doesn't update references to modules specified without attributes
Type: behavior Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder: Close 2to3 issues and list them here
View: 45544
Assigned To: Nosy List: Arfrever, Claudiu.Popa, benjamin.peterson, eric.araujo, jaraco, vinay.sajip
Priority: normal Keywords:

Created on 2011-02-21 20:32 by Arfrever, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (7)
msg128991 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2011-02-21 20:32
$ cat test.py
import cPickle
cPickle
cPickle.load
$ 2to3 -f imports test.py
RefactoringTool: Refactored test.py
--- test.py     (original)
+++ test.py     (refactored)
@@ -1,3 +1,3 @@
-import cPickle
+import pickle
 cPickle
-cPickle.load
+pickle.load
RefactoringTool: Files that need to be modified:
RefactoringTool: test.py
msg129109 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2011-02-22 19:08
While directly referencing a module on its own is useless, this is an issue if the module is used in e.g., an assignment: ``blah = cPickle`` is not changed.
msg129236 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2011-02-24 01:28
I'm trying to remember if this was intentional or not...
msg130915 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2011-03-14 21:52
This bug affects distutils2. See #11502.
msg131032 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2011-03-15 19:59
This bug also affects poster. http://bitbucket.org/jaraco/poster (httplib reference in httpstreaming.py)
msg131042 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2011-03-15 21:37
it looks like lib maintainers can work around the limitation by using the syntax:

 import _winreg as winreg

And then reference the name winreg (or any other preferred name).
msg133924 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-04-17 13:38
Another example: when processing

if hasattr(httplib, 'ssl'):
    pass

It doesn't spot that httplib should be changed to http.client.
History
Date User Action Args
2022-04-11 14:57:13adminsetgithub: 55485
2021-10-20 22:45:46iritkatrielsetstatus: open -> closed
superseder: Close 2to3 issues and list them here
resolution: wont fix
stage: needs patch -> resolved
2015-03-08 07:57:44Claudiu.Popasetnosy: + Claudiu.Popa

type: behavior
versions: + Python 3.5, - Python 3.1, Python 2.7, Python 3.2, Python 3.3
2013-01-11 17:14:31brett.cannonsetnosy: - brett.cannon
2011-04-19 15:33:38eric.araujosetnosy: + eric.araujo
2011-04-17 13:38:29vinay.sajipsetnosy: + vinay.sajip
messages: + msg133924
2011-03-15 21:37:23jaracosetnosy: brett.cannon, jaraco, benjamin.peterson, Arfrever
messages: + msg131042
2011-03-15 20:00:00jaracosetnosy: brett.cannon, jaraco, benjamin.peterson, Arfrever
messages: + msg131032
2011-03-14 21:52:59jaracosetnosy: + jaraco
messages: + msg130915
2011-02-24 01:28:22benjamin.petersonsetnosy: brett.cannon, benjamin.peterson, Arfrever
messages: + msg129236
2011-02-22 19:08:20brett.cannonsetnosy: + brett.cannon

messages: + msg129109
stage: needs patch
2011-02-21 20:47:28Arfreversetnosy: + benjamin.peterson
2011-02-21 20:32:50Arfrevercreate