[Python-3000] Use Py_CLEAR only

Walter Dörwald walter at livinglogic.de
Wed Apr 19 08:47:30 CEST 2006


Greg Ewing wrote:

> Edward C. Jones wrote:
> 
>> Can Py_CLEAR completely replace Py_DECREF and Py_XDECREF?
> 
> It would be less efficient in the cases where you don't
> need to check for NULL and/or clear the reference
> afterwards.

Both should be optimized away by the compiler.

But what we gain is one obvious way to do it, which would be more robust.

This sounds like somebody should simply try it out (but I'm not sure, if 
blindly replacing Py_DECREF and Py_XDECREF with Py_CLEAR would be enough).

Servus,
    Walter



More information about the Python-3000 mailing list