X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fpython%2Fpython.h;h=27d2a9b19b230133327b5e3cfcc828d36188ad8a;hp=46e1a03db9bbada306900df78dc738508268f8d4;hb=7d7ca8ee2eaae704989a1552ad429794d402f550;hpb=9289748ceda0195c346437632be8558587441287 diff --git a/lib/python/python.h b/lib/python/python.h index 46e1a03..27d2a9b 100644 --- a/lib/python/python.h +++ b/lib/python/python.h @@ -3,10 +3,33 @@ #include #include - -typedef struct _object PyObject; +#include // useable for debugging python refcounting +#undef Py_DECREF +#undef Py_XDECREF +#undef Py_INCREF +#undef Py_XINCREF +#define Py_XDECREF(obj) Impl_Py_XDECREF(__FILE__, __LINE__, obj) +#define Py_DECREF(obj) Impl_Py_DECREF(__FILE__, __LINE__, obj) +#define Py_XINCREF(obj) Impl_Py_XINCREF(__FILE__, __LINE__, obj) +#define Py_INCREF(obj) Impl_Py_INCREF(__FILE__, __LINE__, obj) + +void Impl_Py_DECREF(const char* file, int line, PyObject *obj); + +inline void Impl_Py_XDECREF(const char* file, int line, PyObject *obj) +{ + if (obj) + Impl_Py_DECREF(file, line, obj); +} + +void Impl_Py_INCREF(const char* file, int line, PyObject *obj); + +inline void Impl_Py_XINCREF(const char* file, int line, PyObject *obj) +{ + if (obj) + Impl_Py_INCREF(file, line, obj); +} extern PyObject *New_TestObj();