diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-11-23 16:31:19 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-11-23 16:31:19 +0000 |
| commit | 7d7ca8ee2eaae704989a1552ad429794d402f550 (patch) | |
| tree | 1586bab92060b0d6f8e6a447990a42e4e9f4a79b /lib/python/python.h | |
| parent | 4ea3e16caea18f079d66b387d000d9ba2db8fd1b (diff) | |
| download | enigma2-7d7ca8ee2eaae704989a1552ad429794d402f550.tar.gz enigma2-7d7ca8ee2eaae704989a1552ad429794d402f550.zip | |
add PyObject refcount debugging code
Diffstat (limited to 'lib/python/python.h')
| -rw-r--r-- | lib/python/python.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/lib/python/python.h b/lib/python/python.h index 46e1a03d..27d2a9b1 100644 --- a/lib/python/python.h +++ b/lib/python/python.h @@ -3,10 +3,33 @@ #include <string> #include <lib/base/object.h> - -typedef struct _object PyObject; +#include <Python.h> // 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(); |
