Commit 15c349ec authored by Stefan Behnel's avatar Stefan Behnel

fix ref-leak during Py2-style class instantiation

parent 5c1458d1
...@@ -668,9 +668,11 @@ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) { ...@@ -668,9 +668,11 @@ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
if (!metaclass) { if (!metaclass) {
PyErr_Clear(); PyErr_Clear();
metaclass = (PyObject*) Py_TYPE(base); metaclass = (PyObject*) Py_TYPE(base);
Py_INCREF(metaclass);
} }
} else { } else {
metaclass = (PyObject *) &PyClass_Type; metaclass = (PyObject *) &PyClass_Type;
Py_INCREF(metaclass);
} }
#else #else
if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
...@@ -679,8 +681,8 @@ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) { ...@@ -679,8 +681,8 @@ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
} else { } else {
metaclass = (PyObject *) &PyType_Type; metaclass = (PyObject *) &PyType_Type;
} }
#endif
Py_INCREF(metaclass); Py_INCREF(metaclass);
#endif
return metaclass; return metaclass;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment