From 8484165901a7e45188947141bdca8ab23d0ff07d Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Thu, 2 Feb 2006 06:53:07 +0000 Subject: [PATCH] fix for subversion 1.3.0 git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8674 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/python/pyrun.swg | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index 39512c094..2cc107378 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -383,8 +383,7 @@ PySwigObject_type(void) { SWIGRUNTIMEINLINE int PySwigObject_Check(PyObject *op) { - return ((op)->ob_type == PySwigObject_type()) - || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0); + return (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0); } SWIGRUNTIME PyObject * @@ -866,7 +865,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) PyObject *obj = 0; #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) if (PyInstance_Check(pyobj)) { - obj = _PyInstance_Lookup(pyobj, SWIG_This()); + obj = _PyInstance_Lookup(pyobj, SWIG_This()); } else { PyObject **dictptr = _PyObject_GetDictPtr(pyobj); if (dictptr != NULL) { @@ -898,6 +897,11 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) return 0; } #endif + if (obj && !PySwigObject_Check(obj)) { + /* a PyObject is called 'this', try to get the 'real this' + PySwigObject from it */ + return SWIG_Python_GetSwigThis(obj); + } return (PySwigObject *)obj; } }