add check for weakref

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7985 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-12-14 22:58:15 +00:00
commit 45d7395f09

View file

@ -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