Thanks to visit codestin.com
Credit goes to github.com

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
Set the proper relationship between static builtin types and the subi…
…nterpreters.
  • Loading branch information
ericsnowcurrently committed May 1, 2023
commit eeeff5277ea98fb60700b91387b154508acb22b0
12 changes: 9 additions & 3 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -4508,9 +4508,11 @@ _PyStaticType_Dealloc(PyInterpreterState *interp, PyTypeObject *type)

clear_static_type_objects(interp, type);

type->tp_flags &= ~Py_TPFLAGS_READY;
type->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
type->tp_version_tag = 0;
if (_Py_IsMainInterpreter(interp)) {
type->tp_flags &= ~Py_TPFLAGS_READY;
type->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
type->tp_version_tag = 0;
}

_PyStaticType_ClearWeakRefs(interp, type);
static_builtin_state_clear(interp, type);
Expand Down Expand Up @@ -7037,9 +7039,13 @@ _PyStaticType_InitBuiltin(PyInterpreterState *interp, PyTypeObject *self)
if (self->tp_flags & Py_TPFLAGS_READY) {
assert(self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN);
assert(_PyType_CheckConsistency(self));
/* Per-interpreter tp_subclasses is done lazily.
Otherwise we would initialize it here. */
return 0;
}

assert(_Py_IsMainInterpreter(interp));

self->tp_flags |= _Py_TPFLAGS_STATIC_BUILTIN;
self->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;

Expand Down