Skip to content

Commit c5c1238

Browse files
[3.11] GH-101696: invalidate type version tag in _PyStaticType_Dealloc (GH-101697) (#101722)
[3.11] GH-101696: invalidate type version tag in `_PyStaticType_Dealloc` (GH-101697). (cherry picked from commit d9de079) Co-authored-by: Kumar Aditya <[email protected]>
1 parent 91fb7c3 commit c5c1238

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
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

+2
Original file line numberDiff line numberDiff line change
@@ -4080,6 +4080,8 @@ _PyStaticType_Dealloc(PyTypeObject *type)
40804080
}
40814081

40824082
type->tp_flags &= ~Py_TPFLAGS_READY;
4083+
type->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
4084+
type->tp_version_tag = 0;
40834085
}
40844086

40854087

0 commit comments

Comments
 (0)