]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-108765: Include explicitly <unistd.h> in signalmodule.c (#111402)
authorVictor Stinner <vstinner@python.org>
Fri, 27 Oct 2023 20:56:12 +0000 (22:56 +0200)
committerGitHub <noreply@github.com>
Fri, 27 Oct 2023 20:56:12 +0000 (20:56 +0000)
unistd.h is needed by alarm() and pause() functions.

Doc/whatsnew/3.13.rst
Modules/signalmodule.c

index 34dd3ea8858ea22d108c3e3669ff5508376920d5..84d5daae6e623c4c3fe99913adaa376a40134f07 100644 (file)
@@ -1120,7 +1120,8 @@ Porting to Python 3.13
 * ``Python.h`` no longer includes the ``<unistd.h>`` 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 ``<unistd.h>`` and
index 2932d94858afdecd3cbbb16836818f827d947cf3..f3ba0915760f5ef47b6dd73f565fff48e52c3928 100644 (file)
@@ -21,6 +21,9 @@
 #  include "socketmodule.h"       // SOCKET_T
 #endif
 
+#ifdef HAVE_UNISTD_H
+#  include <unistd.h>             // alarm()
+#endif
 #ifdef MS_WINDOWS
 #  ifdef HAVE_PROCESS_H
 #    include <process.h>