Skip to content

Commit 378b24b

Browse files
authored
[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.
1 parent 20b454d commit 378b24b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Include/internal/pycore_stackref.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ _PyStackRef_FromPyObjectSteal(PyObject *obj)
323323
static inline bool
324324
PyStackRef_IsHeapSafe(_PyStackRef stackref)
325325
{
326-
if (PyStackRef_IsDeferred(stackref)) {
326+
if (PyStackRef_IsDeferred(stackref) && !PyStackRef_IsTaggedInt(stackref)) {
327327
PyObject *obj = PyStackRef_AsPyObjectBorrow(stackref);
328328
return obj == NULL || _Py_IsImmortal(obj) || _PyObject_HasDeferredRefcount(obj);
329329
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix crash in the free threading build when clearing frames that hold tagged
2+
integers.

0 commit comments

Comments
 (0)