Re: [PATCH] trace-event-python: give field dict to unhandled callback

From: Pierre Tardy
Date: Mon May 31 2010 - 17:07:53 EST


> The if statement expands to:
>
> if (!handler)
>  if ( --(dict)->ob_refcnt != 0) ; else
> ( (*((PyObject*)(dict))->ob_type->tp_dealloc)((PyObject *)((PyObject
> *)(dict))));
>
yeah, in python2.6 at least, Py_DECREF is protected by do{ } while(0)
#define Py_DECREF(op) \
do { \
if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \
--((PyObject*)(op))->ob_refcnt != 0) \
_Py_CHECK_REFCNT(op) \
else \
_Py_Dealloc((PyObject *)(op)); \
} while (0)

> if (!handler) {
> Py_DECREF(dict);
> }

See a simpler fix in my next email.

--
Pierre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/