Fix assert in PyTuple_GET_SIZE
Occurs in debug interpreter builds of python-3.7 when calling tp_new in a few testcases such as Examples/python/extend. Closes #1321
This commit is contained in:
parent
eda58ca308
commit
0165180735
2 changed files with 12 additions and 4 deletions
|
|
@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||||
Version 4.0.0 (in progress)
|
Version 4.0.0 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2018-09-02: andreas.gaeer,tkrasnukha
|
||||||
|
[Python] #1321 Fix assert in PyTuple_GET_SIZE in debug interpreter builds of python-3.7
|
||||||
|
when calling tp_new.
|
||||||
|
|
||||||
2018-09-01: ChristopherHogan
|
2018-09-01: ChristopherHogan
|
||||||
[Guile] #1288 Fix garbage collection for guile >= 2.0.12.
|
[Guile] #1288 Fix garbage collection for guile >= 2.0.12.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1254,10 +1254,14 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#if PY_VERSION_HEX >= 0x03000000
|
#if PY_VERSION_HEX >= 0x03000000
|
||||||
inst = ((PyTypeObject*) data->newargs)->tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
|
PyObject *empty_args = PyTuple_New(0);
|
||||||
if (inst) {
|
if (empty_args) {
|
||||||
PyObject_SetAttr(inst, SWIG_This(), swig_this);
|
inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, Py_None);
|
||||||
Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
|
Py_DECREF(empty_args);
|
||||||
|
if (inst) {
|
||||||
|
PyObject_SetAttr(inst, SWIG_This(), swig_this);
|
||||||
|
Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PyObject *dict = PyDict_New();
|
PyObject *dict = PyDict_New();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue