From 98a84837fea8fc8fcdeec6701b4da3b253755916 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 27 Oct 2023 17:07:58 +0200 Subject: [PATCH 1/2] gh-108765: Include explicitly in signalmodule.c unistd.h is needed by alarm() and pause(). --- Doc/whatsnew/3.13.rst | 3 ++- Modules/signalmodule.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 34dd3ea8858ea2..84d5daae6e623c 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -1120,7 +1120,8 @@ Porting to Python 3.13 * ``Python.h`` no longer includes the ```` standard header file. If needed, it should now be included explicitly. For example, it provides the functions: ``read()``, ``write()``, ``close()``, ``isatty()``, ``lseek()``, - ``getpid()``, ``getcwd()``, ``sysconf()`` and ``getpagesize()``. + ``getpid()``, ``getcwd()``, ``sysconf()``, ``getpagesize()``, ``alarm()`` and + ``pause()``. As a consequence, ``_POSIX_SEMAPHORES`` and ``_POSIX_THREADS`` macros are no longer defined by ``Python.h``. The ``HAVE_UNISTD_H`` and ``HAVE_PTHREAD_H`` macros defined by ``Python.h`` can be used to decide if ```` and diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 2932d94858afde..56ddc5ea283d93 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -21,6 +21,7 @@ # include "socketmodule.h" // SOCKET_T #endif +#include // alarm() #ifdef MS_WINDOWS # ifdef HAVE_PROCESS_H # include From 638d9d323e18f473607dbbd0812b2ff721bfefec Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 27 Oct 2023 22:26:22 +0200 Subject: [PATCH 2/2] Update Modules/signalmodule.c Co-authored-by: Kirill Podoprigora --- Modules/signalmodule.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 56ddc5ea283d93..f3ba0915760f5e 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -21,7 +21,9 @@ # include "socketmodule.h" // SOCKET_T #endif -#include // alarm() +#ifdef HAVE_UNISTD_H +# include // alarm() +#endif #ifdef MS_WINDOWS # ifdef HAVE_PROCESS_H # include