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 {
|
} else {
|
||||||
data->delargs = 0;
|
data->delargs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -747,28 +746,30 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
|
||||||
if (PySwigObject_Check(pyobj)) {
|
if (PySwigObject_Check(pyobj)) {
|
||||||
return (PySwigObject *) pyobj;
|
return (PySwigObject *) pyobj;
|
||||||
} else {
|
} else {
|
||||||
PyObject *obj;
|
PyObject *obj = 0;
|
||||||
#ifndef SWIG_PYTHON_SLOW_GETSET_THIS
|
#ifndef SWIG_PYTHON_SLOW_GETSET_THIS
|
||||||
if (PyInstance_Check(pyobj)) {
|
if (PyInstance_Check(pyobj)) {
|
||||||
obj = _PyInstance_Lookup(pyobj, SWIG_This());
|
obj = _PyInstance_Lookup(pyobj, SWIG_This());
|
||||||
|
#ifdef PyWeakref_CheckProxy
|
||||||
|
} else if (PyWeakref_CheckProxy(pyobj)) {
|
||||||
|
return SWIG_Python_GetSwigThis(PyWeakref_GetObject(pyobj));
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
|
PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
|
||||||
if (dictptr != NULL) {
|
if (dictptr != NULL) {
|
||||||
PyObject *dict = *dictptr;
|
PyObject *dict = *dictptr;
|
||||||
obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
|
obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
|
||||||
} else {
|
|
||||||
obj = PyObject_GetAttr(pyobj,SWIG_This());
|
|
||||||
Py_XDECREF(obj);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
obj = PyObject_GetAttr(pyobj,SWIG_This());
|
obj = PyObject_GetAttr(pyobj,SWIG_This());
|
||||||
Py_XDECREF(obj);
|
if (obj) {
|
||||||
#endif
|
Py_DECREF(obj);
|
||||||
if (!obj) {
|
} else {
|
||||||
if (PyErr_Occurred()) PyErr_Clear();
|
if (PyErr_Occurred()) PyErr_Clear();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return (PySwigObject *)obj;
|
return (PySwigObject *)obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue