From abae42912cc52dce6414c1a34a2bc640203aa848 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 27 Apr 2023 17:42:07 -0600 Subject: [PATCH] Fix static_builtin_state_init(). --- Objects/typeobject.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 0560caa506ce20d..12fc48d14c062b7 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -121,10 +121,10 @@ static_builtin_state_init(PyTypeObject *self) PyInterpreterState *interp = _PyInterpreterState_GET(); /* It should only be called once for each builtin type. */ - assert(!static_builtin_index_is_set(self)); - - static_builtin_index_set(self, interp->types.num_builtins_initialized); - interp->types.num_builtins_initialized++; + if (!static_builtin_index_is_set(self)) { + static_builtin_index_set(self, interp->types.num_builtins_initialized); + interp->types.num_builtins_initialized++; + } static_builtin_state *state = static_builtin_state_get(interp, self); state->type = self;