Skip to content

Commit 1f212cf

Browse files
Fix _PyStaticType_InitBuiltin() for subinterpreters.
1 parent ae6343f commit 1f212cf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Objects/typeobject.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6758,6 +6758,10 @@ type_ready_pre_checks(PyTypeObject *type)
67586758
static int
67596759
type_ready_set_bases(PyTypeObject *type)
67606760
{
6761+
if (lookup_tp_bases(type) != NULL) {
6762+
return 0;
6763+
}
6764+
67616765
/* Initialize tp_base (defaults to BaseObject unless that's us) */
67626766
PyTypeObject *base = type->tp_base;
67636767
if (base == NULL && type != &PyBaseObject_Type) {
@@ -7274,6 +7278,11 @@ _PyStaticType_InitBuiltin(PyInterpreterState *interp, PyTypeObject *self)
72747278
Otherwise we would initialize it here. */
72757279

72767280
assert(_PyType_CheckConsistency(self));
7281+
/* We must explicitly set these for subinterpreters.
7282+
tp_subclasses is set lazily. */
7283+
type_ready_set_dict(self);
7284+
type_ready_set_bases(self);
7285+
type_ready_mro(self);
72777286
return 0;
72787287
}
72797288

0 commit comments

Comments
 (0)