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:
parent
b9f8d2fbc7
commit
45d7395f09
1 changed files with 7 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue