diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 01f8208f3af3ea..a61e6079d3a3e2 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`` and ``_testimportmultiple`` C extensions are now built with the - :ref:`limited C API `. +* The ``errno``, ``_ctypes_test``, ``_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 index 763e6b89d1ee66..db4849650fd849 100644 --- 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 @@ -1,2 +1,3 @@ -The ``_testimportmultiple`` C extension is now built with the :ref:`limited -C API `. Patch by Victor Stinner. +The ``errno``, ``_ctypes_test`` and ``_testimportmultiple`` C extensions are +now built with the :ref:`limited C API `. Patch by Victor +Stinner. diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c index ddfb2c8a332a9e..11c7a6b8926214 100644 --- a/Modules/_ctypes/_ctypes_test.c +++ b/Modules/_ctypes/_ctypes_test.c @@ -1,11 +1,12 @@ +#define Py_LIMITED_API 0x03060000 + #include +#include // qsort() #ifdef MS_WIN32 -#include +# include #endif -#include // qsort() - #define EXPORT(x) Py_EXPORTED_SYMBOL x /* some functions handy for testing */ diff --git a/Modules/_testimportmultiple.c b/Modules/_testimportmultiple.c index 01c519b1c79ff4..a13024d6cd029e 100644 --- a/Modules/_testimportmultiple.c +++ b/Modules/_testimportmultiple.c @@ -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 diff --git a/Modules/errnomodule.c b/Modules/errnomodule.c index 301ad8313bc512..25cd7e9ae0e122 100644 --- a/Modules/errnomodule.c +++ b/Modules/errnomodule.c @@ -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 -/* 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 + + // 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 /*