Author illume
Recipients
Date 2006-07-06.06:43:16
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Since Py_INCREF and Py_DECREF should not be able to
take NULLs they should do an assert check for this.

This would have caught at least one bug earlier in
cPickle.loads()
http://sourceforge.net/tracker/index.php?func=detail&aid=1512695&group_id=5470&atid=105470

It will also help other extension module authors find
this error in their code more easily.

Include/object.h
#define Py_INCREF(op) (			        \
        (assert((op) != NULL)) ,  	        \
        _Py_INC_REFTOTAL  _Py_REF_DEBUG_COMMA	\
        (op)->ob_refcnt++)                      


#define Py_DECREF(op)					\
	if ((assert((op) != NULL)) , _Py_DEC_REFTOTAL 
_Py_REF_DEBUG_COMMA	\
	    --(op)->ob_refcnt != 0)			\
		_Py_CHECK_REFCNT(op)			\
	else						\
		_Py_Dealloc((PyObject *)(op))

History
Date User Action Args
2007-08-23 15:53:20adminlinkissue1517947 messages
2007-08-23 15:53:20admincreate