From ddc4269e803ea96d90fee3c05d7fdc9c799aaa77 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 15 Oct 2025 15:58:30 +0200 Subject: [PATCH] gh-140153: Fix Py_REFCNT() definition on limited C API 3.11-3.13 --- Include/refcount.h | 2 ++ .../next/C_API/2025-10-15-15-59-59.gh-issue-140153.BO7sH4.rst | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 Misc/NEWS.d/next/C_API/2025-10-15-15-59-59.gh-issue-140153.BO7sH4.rst diff --git a/Include/refcount.h b/Include/refcount.h index ba34461fefcbb0..51346c7e519321 100644 --- a/Include/refcount.h +++ b/Include/refcount.h @@ -114,6 +114,8 @@ PyAPI_FUNC(Py_ssize_t) Py_REFCNT(PyObject *ob); } #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 # define Py_REFCNT(ob) _Py_REFCNT(_PyObject_CAST(ob)) + #else + # define Py_REFCNT(ob) _Py_REFCNT(ob) #endif #endif diff --git a/Misc/NEWS.d/next/C_API/2025-10-15-15-59-59.gh-issue-140153.BO7sH4.rst b/Misc/NEWS.d/next/C_API/2025-10-15-15-59-59.gh-issue-140153.BO7sH4.rst new file mode 100644 index 00000000000000..502c48b6842d1c --- /dev/null +++ b/Misc/NEWS.d/next/C_API/2025-10-15-15-59-59.gh-issue-140153.BO7sH4.rst @@ -0,0 +1,2 @@ +Fix :c:func:`Py_REFCNT` definition on limited C API 3.11-3.13. Patch by +Victor Stinner.