]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-85283: Build _testimportmultiple with limited C API (#110954)
authorVictor Stinner <vstinner@python.org>
Tue, 17 Oct 2023 00:27:15 +0000 (02:27 +0200)
committerGitHub <noreply@github.com>
Tue, 17 Oct 2023 00:27:15 +0000 (02:27 +0200)
Doc/whatsnew/3.13.rst
Misc/NEWS.d/next/Build/2023-10-17-01-56-11.gh-issue-85283.V156T2.rst [new file with mode: 0644]
Modules/_testimportmultiple.c

index 08e7bea4fe2bf991cee2f3189e73f55c07d9078d..01f8208f3af3eabc3296d4adc010ca0e9c290535 100644 (file)
@@ -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
-  <limited-c-api>`.
+* The ``_stat`` and ``_testimportmultiple`` C extensions are now built with the
+  :ref:`limited C API <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 (file)
index 0000000..763e6b8
--- /dev/null
@@ -0,0 +1,2 @@
+The ``_testimportmultiple`` C extension is now built with the :ref:`limited
+C API <limited-c-api>`. Patch by Victor Stinner.
index 1caeb66eb8c85890e2105e3b40716572bf7a5c78..01c519b1c79ff46cf37b491c30dbd128d6919e3e 100644 (file)
@@ -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<Python.h>
+
+#define Py_LIMITED_API 0x030d0000
+
+#include <Python.h>
 
 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);
 }
-