[Numpy-discussion] Changing Fatal error into ImportError?

Robert Kern robert.kern at gmail.com
Wed Aug 30 17:11:21 CDT 2006

Fernando Perez wrote:
> Hi all,
> this was mentioned in the past, but I think it fell through the cracks:
> Python 2.3.4 (#1, Mar 10 2006, 06:12:09)
> [GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import mwadap
> Overwriting info=<function info at 0xb77198b4> from scipy.misc (was
> <function info at 0xb7704bc4> from numpy.lib.utils)
> RuntimeError: module compiled against version 90909 of C-API but this
> version of numpy is 1000002
> Fatal Python error: numpy.core.multiarray failed to import... exiting.
> I really think that this should raise ImportError, but NOT kill the
> python interpreter.  If this happens in the middle of a long-running
> interactive session, you'll lose all of your current state/work, where
> a simple ImportError would have been enough to tell you that this
> particular module needed recompilation.
> FatalError should be reserved for situations where the internal state
> of the Python VM itself can not realistically be expected to be sane
> (corruption, complete memory exhaustion for even internal allocations,
> etc.)  But killing the user's session for a failed import is a bit
> much, IMHO.

I don't see where we're calling Py_FatalError. The problem might be in Python or 
mwadap. Indeed, import_array() raises a PyExc_ImportError.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the Numpy-discussion mailing list