summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_testcapimodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 38c2d1a..3acc757 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -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;