Skip to content

Commit

Permalink
Fix the short-circuit in type_ready_set_bases().
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsnowcurrently committed May 31, 2023
1 parent fe12a90 commit 86f8ec6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -7045,8 +7045,12 @@ type_ready_set_type(PyTypeObject *type)
static int
type_ready_set_bases(PyTypeObject *type)
{
if (lookup_tp_bases(type) != NULL) {
return 0;
if (type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
if (!_Py_IsMainInterpreter(_PyInterpreterState_GET())) {
assert(lookup_tp_bases(type) != NULL);
return 0;
}
assert(lookup_tp_bases(type) == NULL);
}

PyObject *bases = lookup_tp_bases(type);
Expand Down

0 comments on commit 86f8ec6

Please # to comment.