Merge branch 'chlandsi-master'
* chlandsi-master: Testcase for testing __new__ override Python 3.6 fix fix for creating new shadow class in python 3.6
This commit is contained in:
commit
d9ecff1fca
4 changed files with 48 additions and 5 deletions
|
|
@ -1191,12 +1191,16 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
|
|||
#if PY_VERSION_HEX >= 0x03000000
|
||||
PyObject *empty_args = PyTuple_New(0);
|
||||
if (empty_args) {
|
||||
inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, Py_None);
|
||||
Py_DECREF(empty_args);
|
||||
if (inst) {
|
||||
PyObject_SetAttr(inst, SWIG_This(), swig_this);
|
||||
Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
|
||||
PyObject *empty_kwargs = PyDict_New();
|
||||
if (empty_kwargs) {
|
||||
inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, empty_kwargs);
|
||||
Py_DECREF(empty_kwargs);
|
||||
if (inst) {
|
||||
PyObject_SetAttr(inst, SWIG_This(), swig_this);
|
||||
Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
|
||||
}
|
||||
}
|
||||
Py_DECREF(empty_args);
|
||||
}
|
||||
#else
|
||||
PyObject *dict = PyDict_New();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue