diff options
Diffstat (limited to 'Lib/python/pyrun.swg')
-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(); |