[issue7902] relative import broken
Meador Inge
report at bugs.python.org
Wed Feb 24 06:27:39 CET 2010
Meador Inge <meadori at gmail.com> added the comment:
> So doing the import manually through __import__('os', globals(),
> locals(), ['walk'], 1) does not work.
I get the same behavior for this reproduction case regardless of whether I use:
import .os import walk
or:
__import__('os', globals(), locals(), ['walk'], 1)
The bug is reproducible in the trunk.
I think the problem has to do with 'import_module_level' incorrectly doing an absolute lookup for 'os' when the relative lookup in 'foo' fails. I have attached a patch with the relevant fix and test case.
----------
keywords: +patch
nosy: +minge
Added file: http://bugs.python.org/file16350/issue-7902.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7902>
_______________________________________
More information about the Python-bugs-list
mailing list