[Python-Dev] import Numeric fails with user-supplied __import__?

Mr. Bawkbugawk tommy@ilm.com
Tue, 7 May 2002 18:08:46 -0700 (PDT)


Hi All,

I posted this to the numpy discussion list yesterday and haven't heard
back, so I thought I'd swing it through here as well...

------------%< snip %<----------------------%< snip %<------------


Hey Folks,

using the recently released python 2.1.3 with version 20.3 of the
Numeric package, we are getting this behavior:

(tommy@mace)/u0/tommy$ python2
Python 2.1.3 (#1, Apr 22 2002, 16:14:11) [C] on irix6
Type "copyright", "credits" or "license" for more information.
>>> import ihooks
>>> ihooks.install()
>>> import Numeric
Segmentation fault

this is happening on both irix and linux.  I checked the release notes 
for Numeric 20.1 but didn't see any mention of import bugs being
fixed.  a little bit of investigation shows that it isn't even ihooks
that causes this, it is any user-supplied __import__:

blah.py:
import __builtin__

class blah:
    def __init__( self ):
        self.real_importer = __builtin__.__import__
        __builtin__.__import__ = self.my_import

    def my_import( self, name, globs={}, locs={}, fromlist=[] ):
        return self.real_importer( name, globs, locs, fromlist )


_blah = blah()

859:tpelle@parro > python2
Python 2.1.3 (#1, Apr 19 2002, 21:22:42)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-81)] on linux2
Type "copyright", "credits" or "license" for more information.
 >>> import blah
 >>> import Numeric
Segmentation fault (core dumped)


anyone out there seen this before?  any guess if its Numeric's problem 
or perhaps a bug deeper down in python's import architecture?

any and all clues appreciated, thanks!