From cd728c9f05a7e8167cbb21b1ae55506c01e487d4 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 7 Oct 2026 14:32:45 +0200 Subject: [PATCH] Enable Py_SETREF/XSETREF on Python 3.16 limited C API The two macros have been added to Python 3.16 limited C API: https://github.com/python/cpython/commit/ec14f81e74272424778002d5d26002338796e09e --- tests/test_pythoncapi_compat_cext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_pythoncapi_compat_cext.c b/tests/test_pythoncapi_compat_cext.c index c6f7f32..560a5cd 100644 --- a/tests/test_pythoncapi_compat_cext.c +++ b/tests/test_pythoncapi_compat_cext.c @@ -75,7 +75,7 @@ test_object(PyObject *Py_UNUSED(module), PyObject* Py_UNUSED(ignored)) assert(Py_XNewRef(_Py_NULL) == _Py_NULL); -#ifndef Py_LIMITED_API +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03100000 // Py_SETREF() PyObject *setref = Py_NewRef(obj); PyObject *none = Py_None;