SWIG_Python_GetSwigThis now uses PyWeakref
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7984 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6b6f8b1e30
commit
59913ebc6e
1 changed files with 11 additions and 10 deletions
|
|
@ -198,7 +198,6 @@ PySwigClientData_New(PyObject* obj)
|
|||
} else {
|
||||
data->delargs = 0;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
|
@ -747,28 +746,30 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
|
|||
if (PySwigObject_Check(pyobj)) {
|
||||
return (PySwigObject *) pyobj;
|
||||
} else {
|
||||
PyObject *obj;
|
||||
PyObject *obj = 0;
|
||||
#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;
|
||||
} else {
|
||||
obj = PyObject_GetAttr(pyobj,SWIG_This());
|
||||
Py_XDECREF(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
obj = PyObject_GetAttr(pyobj,SWIG_This());
|
||||
Py_XDECREF(obj);
|
||||
#endif
|
||||
if (!obj) {
|
||||
if (obj) {
|
||||
Py_DECREF(obj);
|
||||
} else {
|
||||
if (PyErr_Occurred()) PyErr_Clear();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return (PySwigObject *)obj;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue