[Python-Dev] lookdict

Guido van Rossum guido@beopen.com
Fri, 01 Sep 2000 17:43:29 -0500


> > > - do not call PyErr_Clear() systematically after PyObject_Compare();
> > >   only if (!error_restore && PyErr_Occurred())
> > 
> > What do you mean?  The lookdict code checked in already checks
> > PyErr_Occurrs().
> 
> Was fast again. Actually PyErr_Clear() is called on PyErr_Occurred().
> PyErr_Occurred() is called systematically after PyObject_Compare()
> and it will evaluate to true even if the error was previously fetched.

No, PyErr_Fetch() clears the exception!  PyErr_Restore() restores it.

--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)