From 49cc2f8103b45b89365ba24f7c000f47b47478ab Mon Sep 17 00:00:00 2001 From: Charlie Lin Date: Fri, 2 Jan 2026 08:19:35 -0500 Subject: [PATCH 1/3] Add definitions for PY_CXX_CONSTEXPR, PY_CXX_CONSTEVAL, and PY_CXX_CONSTINIT --- Include/pyport.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Include/pyport.h b/Include/pyport.h index 61e2317976eed1..9b7e45b1b54a53 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -642,6 +642,30 @@ extern "C" { # endif #endif +#ifndef PY_CXX_CONSTEXPR +# if defined(__cplusplus) || __STDC_VERSION__ >= 202311L +# define PY_CXX_CONSTEXPR constexpr +# else +# define PY_CXX_CONSTEXPR +# endif +#endif + +#ifndef PY_CXX_CONSTEVAL +# ifdef __cpp_consteval +# define PY_CXX_CONSTEVAL consteval +# else +# define PY_CXX_CONSTEVAL +# endif +#endif + +#ifndef PY_CXX_CONSTINIT +# ifdef __cpp_constinit +# define PY_CXX_CONSTINIT constinit +# else +# define PY_CXX_CONSTINIT +# endif +#endif + #if defined(__sgi) && !defined(_SGI_MP_SOURCE) # define _SGI_MP_SOURCE #endif From 30b724751f42b020e2037d3e767083a40aa644e4 Mon Sep 17 00:00:00 2001 From: Charlie Lin Date: Fri, 2 Jan 2026 08:31:07 -0500 Subject: [PATCH 2/3] Add another definition of Py_DEPRECATED using the [[deprecated]] attribute --- Include/pyport.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Include/pyport.h b/Include/pyport.h index 9b7e45b1b54a53..a489851e57a87d 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -282,6 +282,8 @@ extern "C" { #elif defined(_MSC_VER) #define Py_DEPRECATED(VERSION) __declspec(deprecated( \ "deprecated in " #VERSION)) +#elif __STDC_VERSION__ >= 202311L || __cplusplus >= 201402L +#define Py_DEPRECATED(VERSION) [[deprecated("Deprecated in "#VERSION)]] #else #define Py_DEPRECATED(VERSION_UNUSED) #endif From 2c9e8a3f2c0e64f414206029ec5280c54ea0527d Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Fri, 2 Jan 2026 13:46:03 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/C_API/2026-01-02-13-46-01.gh-issue-143353.Hy-0xm.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/C_API/2026-01-02-13-46-01.gh-issue-143353.Hy-0xm.rst diff --git a/Misc/NEWS.d/next/C_API/2026-01-02-13-46-01.gh-issue-143353.Hy-0xm.rst b/Misc/NEWS.d/next/C_API/2026-01-02-13-46-01.gh-issue-143353.Hy-0xm.rst new file mode 100644 index 00000000000000..dc91e9f7f99e6b --- /dev/null +++ b/Misc/NEWS.d/next/C_API/2026-01-02-13-46-01.gh-issue-143353.Hy-0xm.rst @@ -0,0 +1 @@ +Add macros for annotating functions with constexpr, consteval, and constinit