Skip to content

Add missing <unistd.h> includes for Python 3.13+ compatibility

Miro Hrončok requested to merge hroncok/dbus-python:unistd into master

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 https://github.com/python/cpython/issues/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

Merge request reports

Loading