Skip to content

Commit dcf4cef

Browse files
hroncoksmcv
andcommitted
Add missing <unistd.h> includes for Python 3.13+ compatibility
According to https://docs.python.org/3.13/whatsnew/3.13.html: > 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(). > (Contributed by Victor Stinner in > python/cpython#108765) The build failures with -Werror=implicit-function-declaration were: .../dbus_bindings/unixfd.c: In function 'UnixFd_tp_new': .../dbus_bindings/unixfd.c:146:10: error: implicit declaration of function 'dup' [-Werror=implicit-function-declaration] 146 | fd = dup(fd_original); | ^~~ .../dbus_bindings/unixfd.c:146:10: warning: nested extern declaration of 'dup' [-Wnested-externs] .../dbus_bindings/unixfd.c:154:9: error: implicit declaration of function 'close'; did you mean 'clone'? [-Werror=implicit-function-declaration] 154 | close(fd); | ^~~~~ | clone [smcv: Adjust include order, don't include unistd.h on Windows] Co-authored-by: Simon McVittie <[email protected]>
1 parent 0d4415c commit dcf4cef

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

dbus_bindings/message-get-args.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828

2929
#include "dbus_bindings-internal.h"
3030

31+
#ifndef _WIN32
32+
#include <unistd.h>
33+
#endif
34+
3135
#define DBG_IS_TOO_VERBOSE
3236
#include "compat-internal.h"
3337
#include "types-internal.h"

dbus_bindings/unixfd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
#include <Python.h>
3232
#include <structmember.h>
3333

34+
#ifndef _WIN32
35+
#include <unistd.h>
36+
#endif
37+
3438
#include "types-internal.h"
3539

3640
PyDoc_STRVAR(UnixFd_tp_doc,

0 commit comments

Comments
 (0)