@@ -74,14 +74,14 @@ static PyObject *
74
74
abc_data_new (PyTypeObject * type , PyObject * args , PyObject * kwds )
75
75
{
76
76
_abc_data * self = (_abc_data * ) type -> tp_alloc (type , 0 );
77
- if (self == NULL ) {
77
+ _abcmodule_state * state = PyType_GetModuleState (type );
78
+ if (self == NULL || state == NULL ) {
78
79
return NULL ;
79
80
}
80
81
81
82
self -> _abc_registry = NULL ;
82
83
self -> _abc_cache = NULL ;
83
84
self -> _abc_negative_cache = NULL ;
84
- _abcmodule_state * state = PyType_GetModuleState (type );
85
85
self -> _abc_negative_cache_version = state -> abc_invalidation_counter ;
86
86
return (PyObject * ) self ;
87
87
}
@@ -606,6 +606,7 @@ _abc__abc_subclasscheck_impl(PyObject *module, PyObject *self,
606
606
}
607
607
608
608
PyObject * ok , * subclasses = NULL , * result = NULL ;
609
+ _abcmodule_state * state = NULL ;
609
610
Py_ssize_t pos ;
610
611
int incache ;
611
612
_abc_data * impl = _get_impl (module , self );
@@ -623,7 +624,7 @@ _abc__abc_subclasscheck_impl(PyObject *module, PyObject *self,
623
624
goto end ;
624
625
}
625
626
626
- _abcmodule_state * state = get_abc_state (module );
627
+ state = get_abc_state (module );
627
628
/* 2. Check negative cache; may have to invalidate. */
628
629
if (impl -> _abc_negative_cache_version < state -> abc_invalidation_counter ) {
629
630
/* Invalidate the negative cache. */
0 commit comments