fixes for python 2.1
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8877 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
8086b62374
commit
31b6e161eb
9 changed files with 27 additions and 12 deletions
|
|
@ -1134,6 +1134,14 @@ SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
|
|||
Py_DECREF(dict);
|
||||
}
|
||||
return inst;
|
||||
#else
|
||||
#if (PY_VERSION_HEX >= 0x02010000)
|
||||
PyObject *inst;
|
||||
PyObject *dict = PyDict_New();
|
||||
PyDict_SetItem(dict, SWIG_This(), swig_this);
|
||||
inst = PyInstance_NewRaw(data->newargs, dict);
|
||||
Py_DECREF(dict);
|
||||
return (PyObject *) inst;
|
||||
#else
|
||||
PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
|
||||
if (inst == NULL) {
|
||||
|
|
@ -1146,9 +1154,16 @@ SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
|
|||
Py_DECREF(inst);
|
||||
return NULL;
|
||||
}
|
||||
#ifdef Py_TPFLAGS_HAVE_WEAKREFS
|
||||
inst->in_weakreflist = NULL;
|
||||
#endif
|
||||
#ifdef Py_TPFLAGS_GC
|
||||
PyObject_GC_Init(inst);
|
||||
#endif
|
||||
PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
|
||||
return (PyObject *) inst;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Create a new pointer object */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue