Skip to content

Commit eeeb23e

Browse files
committed
bpo-40566: Apply tiran's review
1 parent 23e116a commit eeeb23e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Modules/_abc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ static PyObject *
7474
abc_data_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
7575
{
7676
_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) {
7879
return NULL;
7980
}
8081

8182
self->_abc_registry = NULL;
8283
self->_abc_cache = NULL;
8384
self->_abc_negative_cache = NULL;
84-
_abcmodule_state * state = PyType_GetModuleState(type);
8585
self->_abc_negative_cache_version = state->abc_invalidation_counter;
8686
return (PyObject *) self;
8787
}
@@ -606,6 +606,7 @@ _abc__abc_subclasscheck_impl(PyObject *module, PyObject *self,
606606
}
607607

608608
PyObject *ok, *subclasses = NULL, *result = NULL;
609+
_abcmodule_state *state = NULL;
609610
Py_ssize_t pos;
610611
int incache;
611612
_abc_data *impl = _get_impl(module, self);
@@ -623,7 +624,7 @@ _abc__abc_subclasscheck_impl(PyObject *module, PyObject *self,
623624
goto end;
624625
}
625626

626-
_abcmodule_state *state = get_abc_state(module);
627+
state = get_abc_state(module);
627628
/* 2. Check negative cache; may have to invalidate. */
628629
if (impl->_abc_negative_cache_version < state->abc_invalidation_counter) {
629630
/* Invalidate the negative cache. */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy