diff --git a/Include/internal/pycore_stackref.h b/Include/internal/pycore_stackref.h index 9495ccc8ac3889..a3893c96b866b5 100644 --- a/Include/internal/pycore_stackref.h +++ b/Include/internal/pycore_stackref.h @@ -484,16 +484,10 @@ static const _PyStackRef PyStackRef_NULL = { .bits = PyStackRef_NULL_BITS }; #define PyStackRef_False ((_PyStackRef){.bits = ((uintptr_t)&_Py_FalseStruct) | Py_TAG_REFCNT }) #define PyStackRef_None ((_PyStackRef){.bits = ((uintptr_t)&_Py_NoneStruct) | Py_TAG_REFCNT }) -#ifdef Py_GIL_DISABLED -// Checks that mask out the deferred bit in the free threading build. +// Checks mask out the flag bit. #define PyStackRef_IsNone(REF) (((REF).bits & ~Py_TAG_REFCNT) == (uintptr_t)&_Py_NoneStruct) #define PyStackRef_IsTrue(REF) (((REF).bits & ~Py_TAG_REFCNT) == (uintptr_t)&_Py_TrueStruct) #define PyStackRef_IsFalse(REF) (((REF).bits & ~Py_TAG_REFCNT) == (uintptr_t)&_Py_FalseStruct) -#else -#define PyStackRef_IsTrue(REF) ((REF).bits == (((uintptr_t)&_Py_TrueStruct) | Py_TAG_REFCNT)) -#define PyStackRef_IsFalse(REF) ((REF).bits == (((uintptr_t)&_Py_FalseStruct) | Py_TAG_REFCNT)) -#define PyStackRef_IsNone(REF) ((REF).bits == (((uintptr_t)&_Py_NoneStruct) | Py_TAG_REFCNT)) -#endif #define PyStackRef_IsNullOrInt(stackref) (PyStackRef_IsNull(stackref) || PyStackRef_IsTaggedInt(stackref)) diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-11-19-15-40-29.gh-issue-158401.0HWFNv.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-11-19-15-40-29.gh-issue-158401.0HWFNv.rst new file mode 100644 index 00000000000000..734602b82137ad --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-11-19-15-40-29.gh-issue-158401.0HWFNv.rst @@ -0,0 +1,2 @@ +Fixed unreliable truthiness checks in long-running applications that use +Stable ABI extensions compiled on Python 3.11 or lower.