Fix a possible crash due to PyType_FromSpecWithBases() (GH-10304)
If the PyObject_MALLOC() call failed in PyType_FromSpecWithBases(),
PyObject_Free() would be called on a static string in type_dealloc().
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index eeaae1f..b28f494 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2995,6 +2995,7 @@
size_t len = strlen(old_doc)+1;
char *tp_doc = PyObject_MALLOC(len);
if (tp_doc == NULL) {
+ type->tp_doc = NULL;
PyErr_NoMemory();
goto fail;
}