Mart Sõmermaa <[EMAIL PROTECTED]> added the comment:

Attached is a naive proof-of-concept implementation (that breaks things,
i.e. the real implementation should strive for better
general compatibility), but works as expected:

>>> __import__('imprt.foo.foo', submodule=True)
<module 'imprt.foo.foo' from 'imprt/foo/foo.py'>

>>> __import__('imprt.foo.foo', submodule=False)   
<module 'imprt' from 'imprt/__init__.py'>

>>> __import__('imprt.foo.foo')
<module 'imprt' from 'imprt/__init__.py'>

# Die on unexpected arguments like strings, lists etc to
# avoid confusion
>>> __import__('imprt.foo.foo', submodule='z')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: an integer is required

----------
keywords: +patch
Added file: http://bugs.python.org/file12136/issue4438.diff

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4438>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to