Skip to content

Commit 77bb0d5

Browse files
authored
gh-108765: Include explicitly <unistd.h> in signalmodule.c (#111402)
unistd.h is needed by alarm() and pause() functions.
1 parent 8a158a7 commit 77bb0d5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Doc/whatsnew/3.13.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,8 @@ Porting to Python 3.13
11201120
* ``Python.h`` no longer includes the ``<unistd.h>`` standard header file. If
11211121
needed, it should now be included explicitly. For example, it provides the
11221122
functions: ``read()``, ``write()``, ``close()``, ``isatty()``, ``lseek()``,
1123-
``getpid()``, ``getcwd()``, ``sysconf()`` and ``getpagesize()``.
1123+
``getpid()``, ``getcwd()``, ``sysconf()``, ``getpagesize()``, ``alarm()`` and
1124+
``pause()``.
11241125
As a consequence, ``_POSIX_SEMAPHORES`` and ``_POSIX_THREADS`` macros are no
11251126
longer defined by ``Python.h``. The ``HAVE_UNISTD_H`` and ``HAVE_PTHREAD_H``
11261127
macros defined by ``Python.h`` can be used to decide if ``<unistd.h>`` and

Modules/signalmodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
# include "socketmodule.h" // SOCKET_T
2222
#endif
2323

24+
#ifdef HAVE_UNISTD_H
25+
# include <unistd.h> // alarm()
26+
#endif
2427
#ifdef MS_WINDOWS
2528
# ifdef HAVE_PROCESS_H
2629
# include <process.h>

0 commit comments

Comments
 (0)