Skip to content

Commit d9de079

Browse files
GH-101696: invalidate type version tag in _PyStaticType_Dealloc (#101697)
1 parent 2a8bf25 commit d9de079

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Invalidate type version tag in ``_PyStaticType_Dealloc`` for static types, avoiding bug where a false cache hit could crash the interpreter. Patch by Kumar Aditya.

Objects/typeobject.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4469,6 +4469,8 @@ _PyStaticType_Dealloc(PyTypeObject *type)
44694469
}
44704470

44714471
type->tp_flags &= ~Py_TPFLAGS_READY;
4472+
type->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
4473+
type->tp_version_tag = 0;
44724474

44734475
if (type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
44744476
_PyStaticType_ClearWeakRefs(type);

0 commit comments

Comments
 (0)