]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-110968: Py_MOD_PER_INTERPRETER_GIL_SUPPORTED new in 3.13. (#110969)
authorVictor Stinner <vstinner@python.org>
Tue, 17 Oct 2023 10:27:16 +0000 (12:27 +0200)
committerGitHub <noreply@github.com>
Tue, 17 Oct 2023 10:27:16 +0000 (12:27 +0200)
* Only add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED to limited C API
  version 3.13.
* errno, xxlimited and _ctypes_test extensions now need the limited C
  API version 3.13 to get Py_MOD_PER_INTERPRETER_GIL_SUPPORTED.  They
  now include standard header files explicitly: <errno.h>, <string.h>
  and <stdio.h>.
* xxlimited_35: Remove Py_mod_multiple_interpreters slot,
  incompatible with limited C API version 3.5.

Include/moduleobject.h
Modules/_ctypes/_ctypes_test.c
Modules/errnomodule.c
Modules/xxlimited.c
Modules/xxlimited_35.c

index ea08145381cee62d3a39d0aa1a5142c99252cb49..2f7dc254466c46f2af42d820772c5db22a40c1dd 100644 (file)
@@ -79,12 +79,14 @@ struct PyModuleDef_Slot {
 #define _Py_mod_LAST_SLOT 3
 #endif
 
+#endif /* New in 3.5 */
+
 /* for Py_mod_multiple_interpreters: */
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000
 #define Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED ((void *)0)
 #define Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED ((void *)1)
 #define Py_MOD_PER_INTERPRETER_GIL_SUPPORTED ((void *)2)
-
-#endif /* New in 3.5 */
+#endif
 
 struct PyModuleDef {
   PyModuleDef_Base m_base;
index 11c7a6b8926214ebd0bdc504b81401b57444c58e..5473310ded073435f03a8835db1c7ef1774b97ab 100644 (file)
@@ -1,8 +1,11 @@
-#define Py_LIMITED_API 0x03060000
+// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
+#define Py_LIMITED_API 0x030d0000
 
 #include <Python.h>
 
+#include <stdio.h>                // printf()
 #include <stdlib.h>               // qsort()
+#include <string.h>               // memset()
 #ifdef MS_WIN32
 #  include <windows.h>
 #endif
index 25cd7e9ae0e122dd72565c03156fd40b6c6ae694..e4fd3b47762702f9134ce37a235efea33a1fc92e 100644 (file)
@@ -1,9 +1,10 @@
 /* Errno module */
 
-// Need PyModuleDef_Slot added to limited C API version 3.5
-#define Py_LIMITED_API 0x03050000
+// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
+#define Py_LIMITED_API 0x030d0000
 
 #include "Python.h"
+#include <errno.h>                // EPIPE
 
 /* Windows socket errors (WSA*)  */
 #ifdef MS_WINDOWS
index 3935c00fc26530a41671836b6905aa57f2d57bf6..df6e593b320e5227517e12b4705865edbe5a998b 100644 (file)
@@ -62,7 +62,8 @@
           pass
    */
 
-#define Py_LIMITED_API 0x030b0000
+// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
+#define Py_LIMITED_API 0x030d0000
 
 #include "Python.h"
 #include <string.h>
index 1ff3ef1cb6f296e35981997e9d9d9870d460d7f2..361c7e76d77f5082e7f0209c09b3a14cb38fa1a3 100644 (file)
@@ -293,7 +293,6 @@ xx_modexec(PyObject *m)
 
 static PyModuleDef_Slot xx_slots[] = {
     {Py_mod_exec, xx_modexec},
-    {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
     {0, NULL}
 };