From 86f8ec6496b31b1cee07850e11be06a6cbdae794 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Tue, 30 May 2023 16:55:47 -0600 Subject: [PATCH] Fix the short-circuit in type_ready_set_bases(). --- Objects/typeobject.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index a888487fabfee0..83bb76ccce7a16 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -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);