From: Sam Gross Date: Mon, 8 Dec 2025 23:16:28 +0000 (-0500) Subject: [3.14] gh-133932: Tagged ints are heap-safe (free threading) (gh-142431) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=378b24b54e2d0690c165b1ae52af366419dadb4d;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-133932: Tagged ints are heap-safe (free threading) (gh-142431) The previous fix (gh-134494) didn't fix the free threading build. --- diff --git a/Include/internal/pycore_stackref.h b/Include/internal/pycore_stackref.h index 0ce759fc743d..52acd918c9b9 100644 --- a/Include/internal/pycore_stackref.h +++ b/Include/internal/pycore_stackref.h @@ -323,7 +323,7 @@ _PyStackRef_FromPyObjectSteal(PyObject *obj) static inline bool PyStackRef_IsHeapSafe(_PyStackRef stackref) { - if (PyStackRef_IsDeferred(stackref)) { + if (PyStackRef_IsDeferred(stackref) && !PyStackRef_IsTaggedInt(stackref)) { PyObject *obj = PyStackRef_AsPyObjectBorrow(stackref); return obj == NULL || _Py_IsImmortal(obj) || _PyObject_HasDeferredRefcount(obj); } diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-12-08-15-46-06.gh-issue-133932.HAxa4p.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-12-08-15-46-06.gh-issue-133932.HAxa4p.rst new file mode 100644 index 000000000000..460226303599 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-12-08-15-46-06.gh-issue-133932.HAxa4p.rst @@ -0,0 +1,2 @@ +Fix crash in the free threading build when clearing frames that hold tagged +integers.