[issue12864] 2to3 creates illegal code on import a.b inside a package

simohe report at bugs.python.org
Tue Aug 30 23:59:21 CEST 2011


New submission from simohe <simohe at besonet.ch>:

When the current module is in a package and imports submodules, the following lines are converted to illegal code.

-import sub.subsub
+from . import sub.subsub

-import sub, sub.subsub, sub2
+from . import sub, sub.subsub, sub2

A valid alternative:

-import sub.subsub
+from .sub import subsub as _dummy

-import sub, sub.subsub, sub2
+from . import sub, sub2\nfrom .sub import subsub as _dummy

----------
components: 2to3 (2.x to 3.0 conversion tool)
messages: 143237
nosy: simohe
priority: normal
severity: normal
status: open
title: 2to3 creates illegal code on import a.b inside a package
versions: Python 2.6, Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12864>
_______________________________________


More information about the Python-bugs-list mailing list