From: Victor Stinner Date: Tue, 17 Oct 2023 00:27:15 +0000 (+0200) Subject: gh-85283: Build _testimportmultiple with limited C API (#110954) X-Git-Tag: v3.13.0a2~445 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cf9c25c719ba9b0f5bde90fc8b8bba7942d10151;p=thirdparty%2FPython%2Fcpython.git gh-85283: Build _testimportmultiple with limited C API (#110954) --- diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 08e7bea4fe2b..01f8208f3af3 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -932,8 +932,8 @@ 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 - `. +* The ``_stat`` and ``_testimportmultiple`` C extensions are now built with the + :ref:`limited C API `. (Contributed by Victor Stinner in :gh:`85283`.) diff --git a/Misc/NEWS.d/next/Build/2023-10-17-01-56-11.gh-issue-85283.V156T2.rst b/Misc/NEWS.d/next/Build/2023-10-17-01-56-11.gh-issue-85283.V156T2.rst new file mode 100644 index 000000000000..763e6b89d1ee --- /dev/null +++ b/Misc/NEWS.d/next/Build/2023-10-17-01-56-11.gh-issue-85283.V156T2.rst @@ -0,0 +1,2 @@ +The ``_testimportmultiple`` C extension is now built with the :ref:`limited +C API `. Patch by Victor Stinner. diff --git a/Modules/_testimportmultiple.c b/Modules/_testimportmultiple.c index 1caeb66eb8c8..01c519b1c79f 100644 --- a/Modules/_testimportmultiple.c +++ b/Modules/_testimportmultiple.c @@ -3,7 +3,10 @@ * file (issue16421). This file defines 3 modules (_testimportmodule, * foo, bar), only the first one is called the same as the compiled file. */ -#include + +#define Py_LIMITED_API 0x030d0000 + +#include static struct PyModuleDef _testimportmultiple = { PyModuleDef_HEAD_INIT, @@ -54,4 +57,3 @@ static struct PyModuleDef _barmodule = { PyMODINIT_FUNC PyInit__testimportmultiple_bar(void){ return PyModule_Create(&_barmodule); } -