Skip to content

Commit

Permalink
Fix _PyStaticType_InitBuiltin() for subinterpreters.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsnowcurrently committed Apr 27, 2023
1 parent 1799453 commit 48354b9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -6644,6 +6644,10 @@ type_ready_pre_checks(PyTypeObject *type)
static int
type_ready_set_bases(PyTypeObject *type)
{
if (lookup_tp_bases(type) != NULL) {
return 0;
}

/* Initialize tp_base (defaults to BaseObject unless that's us) */
PyTypeObject *base = type->tp_base;
if (base == NULL && type != &PyBaseObject_Type) {
Expand Down Expand Up @@ -7183,6 +7187,11 @@ _PyStaticType_InitBuiltin(PyTypeObject *self)
if (self->tp_flags & Py_TPFLAGS_READY) {
assert(self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN);
assert(_PyType_CheckConsistency(self));
/* We must explicitly set these for subinterpreters.
tp_subclasses is set lazily. */
type_ready_set_dict(self);
type_ready_set_bases(self);
type_ready_mro(self);
return 0;
}

Expand Down

0 comments on commit 48354b9

Please sign in to comment.