Patches item #1517947, was opened at 2006-07-06 06:43
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1517947&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Rene Dudfield (illume)
Assigned to: Nobody/Anonymous (nobody)
Summary: assert for NULL in Py_INCREF Py_DECREF

Initial Comment:
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))



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1517947&group_id=5470
_______________________________________________
Patches mailing list
[email protected]
http://mail.python.org/mailman/listinfo/patches

Reply via email to