[Import-sig] imputil.py patch

Thomas Heller thomas.heller@ion-tof.com
Wed, 18 Jul 2001 18:05:47 +0200


From: "Gordon McMillan" <gmcm@hypernet.com>
> While playing with _xmlplus, I found an incompatibility in 
> imputil.py.
> 
> Background: 
> xml/__init__.py (in the standard lib) does an import of 
> _xmlplus, and if the package is found and the version number 
> of the package is acceptable, it updates sys.modules so that 
> "xml" now points to _xmlplus/__init__.py. Subsequent imports 
> from the xml package now come from _xmlplus.
> 
> The Problem:
> Under the standard import mechanism, these modules show 
> up in sys.modules under the "xml" name. Their __name__ 
> also starts with "xml". The only evidence of the _xmlplus 
> package is that _xmlplus/__init__.py shows up in 
> sys.modules.

Gordon, I cannot confirm this:

C:\Python21>python
ActivePython 2.1, build 211 (ActiveState)
based on Python 2.1 (#15, Jun 18 2001, 21:42:28) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml
>>> xml
<module '_xmlplus' from '_xmlplus\__init__.pyc'>
>>> xml.__name__
'_xmlplus'
>>> ^Z

With imputil (the original one, before your patch):

C:\Python21>python
ActivePython 2.1, build 211 (ActiveState)
based on Python 2.1 (#15, Jun 18 2001, 21:42:28) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import imputil; imputil._test_revamp()
>>> import xml
>>> xml
<module '_xmlplus' from '_xmlplus\__init__.pyc'>
>>> xml.__name__
'_xmlplus'
>>> ^Z

As you see, exactly the same.
What am I missing here?

Thomas