]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-85283: Build errno and _ctypes_test with limited C API (#110955)
authorVictor Stinner <vstinner@python.org>
Tue, 17 Oct 2023 01:05:20 +0000 (03:05 +0200)
committerGitHub <noreply@github.com>
Tue, 17 Oct 2023 01:05:20 +0000 (01:05 +0000)
_testimportmultiple is now built with limited C API version 3.2.

Doc/whatsnew/3.13.rst
Misc/NEWS.d/next/Build/2023-10-17-01-56-11.gh-issue-85283.V156T2.rst
Modules/_ctypes/_ctypes_test.c
Modules/_testimportmultiple.c
Modules/errnomodule.c

index ec76659bee6ae48562fe2c88557dcecc20c4620e..a932be43413b1e1c4be0560b6f5032f2be2120de 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`` and ``_testimportmultiple`` C extensions are now built with the
-  :ref:`limited C API <limited-c-api>`.
+* The ``errno``, ``_ctypes_test``, ``_stat`` and ``_testimportmultiple`` C
+  extensions are now built with the :ref:`limited C API <limited-c-api>`.
   (Contributed by Victor Stinner in :gh:`85283`.)
 
 
index 763e6b89d1ee66d5c89f681491b32684febdf589..db4849650fd8499d28e421ae22a1a87c6bca9ec4 100644 (file)
@@ -1,2 +1,3 @@
-The ``_testimportmultiple`` C extension is now built with the :ref:`limited
-C API <limited-c-api>`. Patch by Victor Stinner.
+The ``errno``, ``_ctypes_test`` and ``_testimportmultiple`` C extensions are
+now built with the :ref:`limited C API <limited-c-api>`. Patch by Victor
+Stinner.
index ddfb2c8a332a9e8873ca6c439817676500d90a92..11c7a6b8926214ebd0bdc504b81401b57444c58e 100644 (file)
@@ -1,11 +1,12 @@
+#define Py_LIMITED_API 0x03060000
+
 #include <Python.h>
 
+#include <stdlib.h>               // qsort()
 #ifdef MS_WIN32
-#include <windows.h>
+#  include <windows.h>
 #endif
 
-#include <stdlib.h>               // qsort()
-
 #define EXPORT(x) Py_EXPORTED_SYMBOL x
 
 /* some functions handy for testing */
index 01c519b1c79ff46cf37b491c30dbd128d6919e3e..a13024d6cd029e1102f99c5f5ff792176ae3b828 100644 (file)
@@ -4,7 +4,7 @@
  * foo, bar), only the first one is called the same as the compiled file.
  */
 
-#define Py_LIMITED_API 0x030d0000
+#define Py_LIMITED_API 0x03020000
 
 #include <Python.h>
 
index 301ad8313bc51278263457dca6610de3e9a847ac..25cd7e9ae0e122dd72565c03156fd40b6c6ae694 100644 (file)
@@ -1,41 +1,44 @@
-
 /* Errno module */
 
+// Need PyModuleDef_Slot added to limited C API version 3.5
+#define Py_LIMITED_API 0x03050000
+
 #include "Python.h"
 
 /* Windows socket errors (WSA*)  */
 #ifdef MS_WINDOWS
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include <windows.h>
-/* The following constants were added to errno.h in VS2010 but have
-   preferred WSA equivalents. */
-#undef EADDRINUSE
-#undef EADDRNOTAVAIL
-#undef EAFNOSUPPORT
-#undef EALREADY
-#undef ECONNABORTED
-#undef ECONNREFUSED
-#undef ECONNRESET
-#undef EDESTADDRREQ
-#undef EHOSTUNREACH
-#undef EINPROGRESS
-#undef EISCONN
-#undef ELOOP
-#undef EMSGSIZE
-#undef ENETDOWN
-#undef ENETRESET
-#undef ENETUNREACH
-#undef ENOBUFS
-#undef ENOPROTOOPT
-#undef ENOTCONN
-#undef ENOTSOCK
-#undef EOPNOTSUPP
-#undef EPROTONOSUPPORT
-#undef EPROTOTYPE
-#undef ETIMEDOUT
-#undef EWOULDBLOCK
+#  ifndef WIN32_LEAN_AND_MEAN
+#    define WIN32_LEAN_AND_MEAN
+#  endif
+#  include <windows.h>
+
+   // The following constants were added to errno.h in VS2010 but have
+   // preferred WSA equivalents.
+#  undef EADDRINUSE
+#  undef EADDRNOTAVAIL
+#  undef EAFNOSUPPORT
+#  undef EALREADY
+#  undef ECONNABORTED
+#  undef ECONNREFUSED
+#  undef ECONNRESET
+#  undef EDESTADDRREQ
+#  undef EHOSTUNREACH
+#  undef EINPROGRESS
+#  undef EISCONN
+#  undef ELOOP
+#  undef EMSGSIZE
+#  undef ENETDOWN
+#  undef ENETRESET
+#  undef ENETUNREACH
+#  undef ENOBUFS
+#  undef ENOPROTOOPT
+#  undef ENOTCONN
+#  undef ENOTSOCK
+#  undef EOPNOTSUPP
+#  undef EPROTONOSUPPORT
+#  undef EPROTOTYPE
+#  undef ETIMEDOUT
+#  undef EWOULDBLOCK
 #endif
 
 /*