X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..1bc4d9b0130f8fe6e9ce44fb3dd6b8d61088160c:/wxPython/src/libpy.c diff --git a/wxPython/src/libpy.c b/wxPython/src/libpy.c index 5841d40a50..d8d22da4f4 100644 --- a/wxPython/src/libpy.c +++ b/wxPython/src/libpy.c @@ -5,10 +5,14 @@ * Contains variable linking and pointer type-checking code. ************************************************************************/ +#include +#include + +#include "Python.h" + #ifdef __cplusplus extern "C" { #endif -#include "Python.h" /* Definitions for Windows/Unix exporting */ #if defined(_WIN32) || defined(__WIN32__) @@ -401,13 +405,32 @@ SWIG_GetPtrObj(PyObject *obj, void **ptr, char *type) { if (!PyString_Check(obj)) { if (!PyInstance_Check(obj) || !(sobj = PyObject_GetAttrString(obj,"this"))) return ""; + // PyObject_GetAttrString increases sobj refcout ! + Py_DECREF(sobj); } str = PyString_AsString(sobj); return SWIG_GetPtr(str,ptr,type); } + #ifdef __cplusplus } #endif + + + + + + + + + + + + + + + +