[Python-Dev] lookdict

Vladimir Marangozov Vladimir.Marangozov@inrialpes.fr
Fri, 1 Sep 2000 23:51:47 +0200 (CEST)


Guido van Rossum wrote:
> 
> > > > - 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.

Oops, right. This saves a function call, then. Still good.

-- 
       Vladimir MARANGOZOV          | Vladimir.Marangozov@inrialpes.fr
http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252