Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eeeb23e

Browse filesBrowse files
committed
bpo-40566: Apply tiran's review
1 parent 23e116a commit eeeb23e
Copy full SHA for eeeb23e

File tree

1 file changed

+4
-3
lines changed
Filter options

1 file changed

+4
-3
lines changed

‎Modules/_abc.c

Copy file name to clipboardExpand all lines: Modules/_abc.c
+4-3Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.