[Python-Dev] Minor issue with PyErr_NormalizeException

Guido van Rossum guido@python.org
Thu, 10 Apr 2003 16:21:32 -0400

> We had a bug in one of our extension modules that caused a core dump in
> PyErr_NormalizeException().  At the very top of the function (line 133) it
> checks for a NULL type.  I think it should have a "return" here so that
> the code does not continue and thus dump core on line 153 when it calls
> PyClass_Check(type).  This should also make the comment not lie about
> dumping core. ;)
> Just thought I'd pass it on..

Thanks!  You're right, the comment is misleading and the call to
PyErr_SetString() was bogus.

Tim and Barry suggested to replace it with a call to Py_FatalError(),
but I think that's wrong too: I found several places where
PyErr_NormalizeException() is used and a few lines later a check is
made whether the exception type is NULL, so I think ignoring this call
is safer.

I'll fix this in CVS, and backport to 2.2.

--Guido van Rossum (home page: http://www.python.org/~guido/)