From 022ef91a4f43f57ccea977ef16f4e7beb76f2d92 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 12 Oct 2023 00:06:20 +0200 Subject: [PATCH] gh-85283: _stat extension now uses the limited C API (#110711) gh-85283: _stat extension uses the limited C API The _stat C extension is now built with the limited C API. --- Doc/whatsnew/3.13.rst | 4 ++++ .../next/Build/2023-08-29-15-05-09.gh-issue-85283.tlK7G7.rst | 2 ++ Modules/_stat.c | 3 +++ 3 files changed, 9 insertions(+) create mode 100644 Misc/NEWS.d/next/Build/2023-08-29-15-05-09.gh-issue-85283.tlK7G7.rst diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index b0a0d89c8d95195..dfce976fbb50eeb 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -928,6 +928,10 @@ Build Changes * Building CPython now requires a compiler with support for the C11 atomic library, GCC built-in atomic functions, or MSVC interlocked intrinsics. +* The ``_stat`` C extension is now built with the :ref:`limited C API + `. + (Contributed by Victor Stinner in :gh:`85283`.) + C API Changes ============= diff --git a/Misc/NEWS.d/next/Build/2023-08-29-15-05-09.gh-issue-85283.tlK7G7.rst b/Misc/NEWS.d/next/Build/2023-08-29-15-05-09.gh-issue-85283.tlK7G7.rst new file mode 100644 index 000000000000000..09b56610e3c23d3 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2023-08-29-15-05-09.gh-issue-85283.tlK7G7.rst @@ -0,0 +1,2 @@ +The ``_stat`` C extension is now built with the :ref:`limited C API +`. Patch by Victor Stinner. diff --git a/Modules/_stat.c b/Modules/_stat.c index 3fd951b6fc1022c..402fbbaecf8dd8a 100644 --- a/Modules/_stat.c +++ b/Modules/_stat.c @@ -11,6 +11,9 @@ * */ +// Need limited C API version 3.13 for PyModule_Add() on Windows +#define Py_LIMITED_API 0x030d0000 + #include "Python.h" #ifdef HAVE_SYS_TYPES_H