diff options
author | Christian Landsiedel <christian.landsiedel@microsoft.com> | 2018-11-22 14:24:49 +0100 |
---|---|---|
committer | Christian Landsiedel <christian.landsiedel@microsoft.com> | 2018-11-22 14:24:49 +0100 |
commit | 3208ff2bf54f523da3b0fd849df3cf7e686771fa (patch) | |
tree | 6193762c1f2db2e213efa2c04eac107e1d85549f /Lib/python | |
parent | 902f3f0ac58faaacbb4f53f73449b8da42486bb1 (diff) | |
download | swig-3208ff2bf54f523da3b0fd849df3cf7e686771fa.tar.gz |
fix for creating new shadow class in python 3.6
Diffstat (limited to 'Lib/python')
-rw-r--r-- | Lib/python/pyrun.swg | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index 7386ff7e2..650e30d3e 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -1205,12 +1205,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(); |