[Python-Dev] Proposal: C API Macro to decref and set to NULL

Guido van Rossum guido at python.org
Tue Jul 13 06:27:07 CEST 2004

> > Just my two cents, but the name suggests to me that it's doing
> > more than a simple decref and set to NULL.  I can't think of
> > anything else off the top of my head that seems obviously better
> > though.


In pystate.c you'll find:

#define ZAP(x) { \
	PyObject *tmp = (PyObject *)(x); \
	(x) = NULL; \
	Py_XDECREF(tmp); \

Call it Py_ZAP and you have my vote. :-)

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

More information about the Python-Dev mailing list