Commit 484c913e authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #27225: Fixed a reference leak in type_new when setting __new__ fails.

Patch by Xiang Zhang.
parent 3c5fa560
......@@ -2575,8 +2575,10 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
tmp = PyStaticMethod_New(tmp);
if (tmp == NULL)
goto error;
if (_PyDict_SetItemId(dict, &PyId___new__, tmp) < 0)
if (_PyDict_SetItemId(dict, &PyId___new__, tmp) < 0) {
Py_DECREF(tmp);
goto error;
}
Py_DECREF(tmp);
}
......
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