diff --git a/Objects/structseq.c b/Objects/structseq.c index 28cbb1901f4..c3b9a72989a 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -383,6 +383,8 @@ PyTypeObject* PyStructSequence_NewType(PyStructSequence_Desc *desc) { PyTypeObject *result = (PyTypeObject*)PyType_GenericAlloc(&PyType_Type, 0); - PyStructSequence_InitType(result, desc); + if (result != NULL) { + PyStructSequence_InitType(result, desc); + } return result; }