fix SWIG_Python_SetSwigThis reported by Robin
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8964 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e914e7dd6a
commit
eaa4febc80
1 changed files with 15 additions and 18 deletions
|
|
@ -1167,25 +1167,22 @@ SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
|
||||||
SWIGRUNTIME void
|
SWIGRUNTIME void
|
||||||
SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
|
SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
|
||||||
{
|
{
|
||||||
|
PyObject *dict;
|
||||||
#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
|
#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
|
||||||
PyObject **dictptr = _PyObject_GetDictPtr(inst);
|
PyObject **dictptr = _PyObject_GetDictPtr(inst);
|
||||||
if (dictptr != NULL) {
|
if (dictptr != NULL) {
|
||||||
PyObject *dict = *dictptr;
|
dict = *dictptr;
|
||||||
if (dict == NULL) {
|
if (dict == NULL) {
|
||||||
dict = PyDict_New();
|
dict = PyDict_New();
|
||||||
*dictptr = dict;
|
*dictptr = dict;
|
||||||
PyDict_SetItem(dict, SWIG_This(), swig_this);
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
PyObject *dict = PyObject_GetAttrString(inst, "__dict__");
|
|
||||||
PyDict_SetItem(dict, SWIG_This(), swig_this);
|
PyDict_SetItem(dict, SWIG_This(), swig_this);
|
||||||
Py_DECREF(dict);
|
return;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
PyObject *dict = PyObject_GetAttrString(inst, "__dict__");
|
|
||||||
PyDict_SetItem(dict, SWIG_This(), swig_this);
|
|
||||||
Py_DECREF(dict);
|
|
||||||
#endif
|
#endif
|
||||||
|
dict = PyObject_GetAttrString(inst, "__dict__");
|
||||||
|
PyDict_SetItem(dict, SWIG_This(), swig_this);
|
||||||
|
Py_DECREF(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue