Skip to content

Commit 0b12944

Browse files
committed
Moved subinterpreter builtin types cleanup code to add_operators()
1 parent 589b259 commit 0b12944

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

Objects/typeobject.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8075,17 +8075,6 @@ type_ready_fill_dict(PyTypeObject *type)
80758075
if (type_dict_set_doc(type) < 0) {
80768076
return -1;
80778077
}
8078-
/* For now, we work around issues with slot wrappers
8079-
for builtin types in subinterpreters.
8080-
See https://github.com/python/cpython/issues/117482. */
8081-
if (type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
8082-
PyInterpreterState *interp = _PyInterpreterState_GET();
8083-
if (!_Py_IsMainInterpreter(interp)) {
8084-
if (fix_builtin_slot_wrappers(type, interp) < 0) {
8085-
return -1;
8086-
}
8087-
}
8088-
}
80898078
return 0;
80908079
}
80918080

@@ -11154,6 +11143,19 @@ add_operators(PyTypeObject *type)
1115411143
Py_DECREF(descr);
1115511144
}
1115611145
}
11146+
11147+
/* For now, we work around issues with slot wrappers
11148+
for builtin types in subinterpreters.
11149+
See https://github.com/python/cpython/issues/117482. */
11150+
if (type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
11151+
PyInterpreterState *interp = _PyInterpreterState_GET();
11152+
if (!_Py_IsMainInterpreter(interp)) {
11153+
if (fix_builtin_slot_wrappers(type, interp) < 0) {
11154+
return -1;
11155+
}
11156+
}
11157+
}
11158+
1115711159
return 0;
1115811160
}
1115911161

0 commit comments

Comments
 (0)