[IronPython] Importing package with imp

Dino Viehland dinov at exchange.microsoft.com
Fri Nov 2 10:20:50 PDT 2007


Thanks for the report!  It looks like we're just passing the wrong name to Importer.InitializeModule (initPath instead of moduleName).  I'll check-in a fix and update test_imp_package() to check sys.modules.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sanghyeon Seo
Sent: Thursday, November 01, 2007 10:50 PM
To: Discussion of IronPython
Subject: [IronPython] Importing package with imp

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
_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


More information about the Users mailing list