Visitar URL original
gh-104614: Make Sure ob_type is Always Set Correctly by PyType_Ready() by ericsnowcurrently · Pull Request #105122 · python/cpython · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix the short-circuit in type_ready_set_bases().
  • Loading branch information
ericsnowcurrently committed May 31, 2023
commit 86f8ec6496b31b1cee07850e11be06a6cbdae794
8 changes: 6 additions & 2 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down