[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Lib/test test___all__.py,1.3,1.4

Skip Montanaro skip@mojam.com (Skip Montanaro)
Wed, 24 Jan 2001 00:28:21 -0600 (CST)


    Guido> I think I saw a complaint about this that specifically said that
    Guido> when dbhash is imported when bsddb can't be imported, an
    Guido> incomplete dbhash is left behind in sys.modules, and then a
    Guido> second import of dbhash will succeed -- but of course it will
    Guido> define no objects.

So it does:

    % ./python
    Python 2.1a1 (#2, Jan 23 2001, 23:30:41) 
    [GCC 2.95.3 19991030 (prerelease)] on linux2
    Type "copyright", "credits" or "license" for more information.
    >>> import dbhash
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
      File "/home/beluga/skip/src/python/dist/src/Lib/dbhash.py", line 3, in ?
	import bsddb
    ImportError: No module named bsddb
    >>> import dbhash
    >>>

Can that be construed as a bug?  If import fails, shouldn't the stub module
that was inserted in sys.modules be removed?

Skip