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 mishandles "from module_name import" when module_name includes an underscore
Type: Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.0, Python 3.1, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: MLModel, benjamin.peterson
Priority: normal Keywords:

Created on 2009-05-27 18:53 by MLModel, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg88427 - (view) Author: Mitchell Model (MLModel) Date: 2009-05-27 18:53
2to3 -f import l.py
--- l.py (original)
File p.py (the four modules exist in the same directory as p.py):

from mod_a import a
from modb import b
from mod_c import *
from modd import *


% 2to3 -f import p.py
+++ p.py (refactored)
@@ -1,5 +1,5 @@
-from mod_a import a
-from modb import b
-from mod_c import *
-from modd import *
+from .mod_a import a
+from .modb import b
+from .mod_c import *
+from .modd import *
msg88443 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-05-27 20:53
I'm sorry; I don't see why this is a bug. Could you elaborate, please?
msg88456 - (view) Author: Mitchell Model (MLModel) Date: 2009-05-27 23:55
I apologize. This example evolved from my attempt to simplify things
from the actual code, and I oversimplified to the point where I misread
the 2to3 results. I thought there was a space after the period for the
modules without the underscores in their name but obviously there
wasn't. In the original results there were a lot of "from . import
modulename" and while experimenting with my examples I carelessly
confused the import of an entire module with the import of a name or *
from a module. Sorry for the bother. (There really was a problem with
the code that read "from .modulename import *", but of course it wasn't
that a space was missing after the period.)
History
Date User Action Args
2022-04-11 14:56:49adminsetgithub: 50375
2009-05-28 00:33:30r.david.murraysetstatus: open -> closed
resolution: not a bug
stage: resolved
2009-05-27 23:55:11MLModelsetmessages: + msg88456
2009-05-27 20:53:27benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg88443
2009-05-27 18:53:12MLModelcreate