[New-bugs-announce] [issue2090] __import__ with fromlist=[''] causes double initialization of modules

hauser report at bugs.python.org
Tue Feb 12 21:50:37 CET 2008


New submission from hauser:

This construction:

__import__( 'pkg', {}, {}, [''] )

Will cause double initialization of package 'pkg', once with name 'pkg'
and second one with name 'pkg.' (trailing dot). Implementation tries to
import subpackage of 'pkg' with empty name, and imports the same package
twice.

This kind of construction is used as a hacky way to obtain exact module
instead of top-level module in return value. It is a hack, but should
not cause this kind of side effects.

----------
components: Interpreter Core
files: empty_import.tgz
messages: 62333
nosy: hauser
severity: minor
status: open
title: __import__ with fromlist=[''] causes double initialization of modules
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file9420/empty_import.tgz

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2090>
__________________________________


More information about the New-bugs-announce mailing list