https://github.com/python/cpython/commit/378b24b54e2d0690c165b1ae52af366419dadb4d
commit: 378b24b54e2d0690c165b1ae52af366419dadb4d
branch: 3.14
author: Sam Gross <[email protected]>
committer: colesbury <[email protected]>
date: 2025-12-08T18:16:28-05:00
summary:

[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.

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2025-12-08-15-46-06.gh-issue-133932.HAxa4p.rst
M Include/internal/pycore_stackref.h

diff --git a/Include/internal/pycore_stackref.h 
b/Include/internal/pycore_stackref.h
index 0ce759fc743d82..52acd918c9b9f9 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 00000000000000..460226303599e2
--- /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.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to