From 45d7395f09a645e50fe2854d606cf3d32ce2b34b Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Wed, 14 Dec 2005 22:58:15 +0000 Subject: [PATCH] add check for weakref git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7985 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/python/pyrun.swg | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index 850418510..cbca0ffc1 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -750,16 +750,18 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #ifndef SWIG_PYTHON_SLOW_GETSET_THIS if (PyInstance_Check(pyobj)) { obj = _PyInstance_Lookup(pyobj, SWIG_This()); -#ifdef PyWeakref_CheckProxy - } else if (PyWeakref_CheckProxy(pyobj)) { - return SWIG_Python_GetSwigThis(PyWeakref_GetObject(pyobj)); -#endif } else { PyObject **dictptr = _PyObject_GetDictPtr(pyobj); if (dictptr != NULL) { PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } +#ifdef PyWeakref_CheckProxy + else if (PyWeakref_CheckProxy(pyobj)) { + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; + } +#endif } #else obj = PyObject_GetAttr(pyobj,SWIG_This()); @@ -774,6 +776,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) } } + /* Acquire a pointer value */ SWIGRUNTIME int