[IronPython] Importing package with imp

Sanghyeon Seo sanxiyn at gmail.com
Fri Nov 2 06:50:10 CET 2007

Importing package with imp module is tested in test_imp_package()
function of test_imp.py. But sys.modules is incorrectly modified by
imp which this test misses...

Okay, if I was not working on some obscure importing hack, I guess no
one would have found this. :(

How to reproduce:

# x/__init__.py
a = 1

# test.py
import imp
imp.load_module('x', None, 'x', ('', '', imp.PKG_DIRECTORY))
import sys
print sys.modules['x'].a

Seo Sanghyeon

More information about the Ironpython-users mailing list