mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
gh-104614: Fix potential ref. leak in _testcapimodule/get_basic_static_type() (#105225)
This commit is contained in:
parent
0dafc785ee
commit
e01b04c907
1 changed files with 3 additions and 1 deletions
|
@ -2671,13 +2671,15 @@ get_basic_static_type(PyObject *self, PyObject *args)
|
|||
PyTypeObject *cls = &BasicStaticTypes[num_basic_static_types_used++];
|
||||
|
||||
if (base != NULL) {
|
||||
cls->tp_base = (PyTypeObject *)Py_NewRef(base);
|
||||
cls->tp_bases = Py_BuildValue("(O)", base);
|
||||
if (cls->tp_bases == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
cls->tp_base = (PyTypeObject *)Py_NewRef(base);
|
||||
}
|
||||
if (PyType_Ready(cls) < 0) {
|
||||
Py_DECREF(cls->tp_bases);
|
||||
Py_DECREF(cls->tp_base);
|
||||
return NULL;
|
||||
}
|
||||
return (PyObject *)cls;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue