mirror of https://github.com/python/cpython
GH-101696: invalidate type version tag in `_PyStaticType_Dealloc` (#101697)
This commit is contained in:
parent
2a8bf25804
commit
d9de079248
|
@ -0,0 +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.
|
|
@ -4469,6 +4469,8 @@ _PyStaticType_Dealloc(PyTypeObject *type)
|
||||||
}
|
}
|
||||||
|
|
||||||
type->tp_flags &= ~Py_TPFLAGS_READY;
|
type->tp_flags &= ~Py_TPFLAGS_READY;
|
||||||
|
type->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
|
||||||
|
type->tp_version_tag = 0;
|
||||||
|
|
||||||
if (type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
if (type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
||||||
_PyStaticType_ClearWeakRefs(type);
|
_PyStaticType_ClearWeakRefs(type);
|
||||||
|
|
Loading…
Reference in New Issue