@@ -543,23 +543,23 @@ pytype_getmodulebytoken(PyObject *self, PyObject *args)
543543 return PyType_GetModuleByToken ((PyTypeObject * )type , token );
544544}
545545
546- static PyType_Slot HeapCTypeWithBasesSlotInvalid_slots [] = {
546+ static PyType_Slot HeapCTypeWithBasesSlotNone_slots [] = {
547547 {Py_tp_bases , NULL }, /* filled out with Py_None in runtime */
548548 {0 , 0 },
549549};
550550
551- static PyType_Spec HeapCTypeWithBasesSlotInvalid_spec = {
552- .name = "_testcapi.HeapCTypeWithBasesSlotInvalid " ,
551+ static PyType_Spec HeapCTypeWithBasesSlotNone_spec = {
552+ .name = "_testcapi.HeapCTypeWithBasesSlotNone " ,
553553 .basicsize = sizeof (PyObject ),
554554 .flags = Py_TPFLAGS_DEFAULT ,
555- .slots = HeapCTypeWithBasesSlotInvalid_slots
555+ .slots = HeapCTypeWithBasesSlotNone_slots
556556};
557557
558558static PyObject *
559- create_heapctype_with_invalid_bases_slot (PyObject * self , PyObject * Py_UNUSED (ignored ))
559+ create_heapctype_with_none_bases_slot (PyObject * self , PyObject * Py_UNUSED (ignored ))
560560{
561- HeapCTypeWithBasesSlotInvalid_slots [0 ].pfunc = Py_None ;
562- return PyType_FromSpec (& HeapCTypeWithBasesSlotInvalid_spec );
561+ HeapCTypeWithBasesSlotNone_slots [0 ].pfunc = Py_None ;
562+ return PyType_FromSpec (& HeapCTypeWithBasesSlotNone_spec );
563563}
564564
565565
@@ -581,8 +581,8 @@ static PyMethodDef TestMethods[] = {
581581 {"pytype_getbasebytoken" , pytype_getbasebytoken , METH_VARARGS },
582582 {"pytype_getmodulebydef" , pytype_getmodulebydef , METH_O },
583583 {"pytype_getmodulebytoken" , pytype_getmodulebytoken , METH_VARARGS },
584- {"create_heapctype_with_invalid_bases_slot " ,
585- create_heapctype_with_invalid_bases_slot , METH_NOARGS },
584+ {"create_heapctype_with_none_bases_slot " ,
585+ create_heapctype_with_none_bases_slot , METH_NOARGS },
586586 {NULL },
587587};
588588
@@ -1472,6 +1472,9 @@ _PyTestCapi_Init_Heaptype(PyObject *m) {
14721472 HeapCTypeWithBasesSlot_slots [0 ].pfunc = bases ;
14731473 PyObject * HeapCTypeWithBasesSlot = PyType_FromSpec (& HeapCTypeWithBasesSlot_spec );
14741474 Py_DECREF (bases );
1475+ if (HeapCTypeWithBasesSlot == NULL ) {
1476+ return -1 ;
1477+ }
14751478 ADD ("HeapCTypeWithBasesSlot" , HeapCTypeWithBasesSlot );
14761479
14771480 ADD ("Py_TP_USE_SPEC" , PyLong_FromVoidPtr (Py_TP_USE_SPEC ));
0 commit comments