From 7ceec6f45820ebe48a36ab72e74ef4ebeeac5a58 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Thu, 22 Dec 2005 08:47:02 +0000 Subject: [PATCH] add support for __slot__ case git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8038 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/python/pyrun.swg | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index 867868ab6..917d4df45 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -236,7 +236,7 @@ PySwigClientData_Del(PySwigClientData* data) free(data); } -/* PySwigObject */ +/* =============== PySwigObject =====================*/ typedef struct { PyObject_HEAD @@ -840,6 +840,15 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } #endif + if (!obj) { + obj = PyObject_GetAttr(pyobj,SWIG_This()); + if (obj) { + Py_DECREF(obj); + } else { + if (PyErr_Occurred()) PyErr_Clear(); + return 0; + } + } } #else obj = PyObject_GetAttr(pyobj,SWIG_This()); @@ -984,7 +993,7 @@ SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this) *dictptr = dict; PyDict_SetItem(dict, SWIG_This(), swig_this); } - } + } #else PyObject *key = SWIG_This(); PyObject_SetAttr(inst, key, swig_this);