[Import-sig] imputil.py patch

Gordon McMillan gmcm@hypernet.com
Wed, 18 Jul 2001 14:46:30 -0400


Thomas Heller wrote:
> 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

You have to go below xml/__init__.py. That one shows up as 
both xml and _xmlplus in both cases. But try, say, 
xml.sax.saxlib.


- Gordon