#7 Add <unistd.h> includes for Python 3.13+ compatibility
Opened 7 months ago by churchyard. Modified 7 months ago
rpms/ churchyard/dbus-python python3.13  into  rawhide

@@ -0,0 +1,59 @@ 

+ From 185ed2dca9d7235402c2fb1ceba77777a1060cef Mon Sep 17 00:00:00 2001

+ From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>

+ Date: Tue, 31 Oct 2023 12:54:51 +0100

+ Subject: [PATCH] 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

+ > 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

+ ---

+  dbus_bindings/message-get-args.c | 2 ++

+  dbus_bindings/unixfd.c           | 1 +

+  2 files changed, 3 insertions(+)

+ 

+ diff --git a/dbus_bindings/message-get-args.c b/dbus_bindings/message-get-args.c

+ index 628a616..f6630b5 100644

+ --- a/dbus_bindings/message-get-args.c

+ +++ b/dbus_bindings/message-get-args.c

+ @@ -26,6 +26,8 @@

+   * DEALINGS IN THE SOFTWARE.

+   */

+  

+ +#include <unistd.h>

+ +

+  #include "dbus_bindings-internal.h"

+  

+  #define DBG_IS_TOO_VERBOSE

+ diff --git a/dbus_bindings/unixfd.c b/dbus_bindings/unixfd.c

+ index e515cd3..68399b0 100644

+ --- a/dbus_bindings/unixfd.c

+ +++ b/dbus_bindings/unixfd.c

+ @@ -30,6 +30,7 @@

+  

+  #include <Python.h>

+  #include <structmember.h>

+ +#include <unistd.h>

+  

+  #include "types-internal.h"

+  

+ -- 

+ GitLab

+ 

file modified
+3
@@ -13,6 +13,9 @@ 

  

  # borrow centos7 patch to use sitearch properly

  Patch0: 0001-Move-python-modules-to-architecture-specific-directo.patch

+ # Python 3.13 compatibility: https://gitlab.freedesktop.org/dbus/dbus-python/-/merge_requests/28

+ # Fixes https://bugzilla.redhat.com/2247222

+ Patch1: 0001-Add-missing-unistd.h-includes-for-Python-3.13-compat.patch

  

  BuildRequires: gnupg2

  BuildRequires: pkgconfig(dbus-1)