Skip to content

Commit 48354b9

Browse files
Fix _PyStaticType_InitBuiltin() for subinterpreters.
1 parent 1799453 commit 48354b9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Objects/typeobject.c

+9
Original file line numberDiff line numberDiff line change
@@ -6644,6 +6644,10 @@ type_ready_pre_checks(PyTypeObject *type)
66446644
static int
66456645
type_ready_set_bases(PyTypeObject *type)
66466646
{
6647+
if (lookup_tp_bases(type) != NULL) {
6648+
return 0;
6649+
}
6650+
66476651
/* Initialize tp_base (defaults to BaseObject unless that's us) */
66486652
PyTypeObject *base = type->tp_base;
66496653
if (base == NULL && type != &PyBaseObject_Type) {
@@ -7183,6 +7187,11 @@ _PyStaticType_InitBuiltin(PyTypeObject *self)
71837187
if (self->tp_flags & Py_TPFLAGS_READY) {
71847188
assert(self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN);
71857189
assert(_PyType_CheckConsistency(self));
7190+
/* We must explicitly set these for subinterpreters.
7191+
tp_subclasses is set lazily. */
7192+
type_ready_set_dict(self);
7193+
type_ready_set_bases(self);
7194+
type_ready_mro(self);
71867195
return 0;
71877196
}
71887197

0 commit comments

Comments
 (0)