Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libftdi1 for openSUSE:Factory checked in at 2026-08-21 16:50:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libftdi1 (Old) and /work/SRC/openSUSE:Factory/.libftdi1.new.1258 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libftdi1" Fri Aug 21 16:50:10 2026 rev:26 rq:1371948 version:1.6rc1.2+git.92d657b Changes: -------- --- /work/SRC/openSUSE:Factory/libftdi1/libftdi1.changes 2026-02-27 17:07:08.997251156 +0100 +++ /work/SRC/openSUSE:Factory/.libftdi1.new.1258/libftdi1.changes 2026-08-21 16:50:49.494632475 +0200 @@ -1,0 +2,10 @@ +Thu Aug 6 11:44:44 UTC 2026 - Martin Pluskal <[email protected]> + +- Add libftdi1-swig-4.5-python3-api.patch: the python typemaps called + PyInt_AsLong() unguarded, which only compiled because SWIG emitted a + Python 2 compatibility macro for it. SWIG 4.5.0 drops Python 2 and + removes those macros, so the generated wrapper failed to build with + "implicit declaration of function 'PyInt_AsLong'". Use a guarded + helper instead, matching the existing helpers in ftdi1.i + +------------------------------------------------------------------- New: ---- libftdi1-swig-4.5-python3-api.patch ----------(New B)---------- New: - Add libftdi1-swig-4.5-python3-api.patch: the python typemaps called PyInt_AsLong() unguarded, which only compiled because SWIG emitted a ----------(New E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libftdi1.spec ++++++ --- /var/tmp/diff_new_pack.rsGPuN/_old 2026-08-21 16:50:50.932684120 +0200 +++ /var/tmp/diff_new_pack.rsGPuN/_new 2026-08-21 16:50:50.934684192 +0200 @@ -1,7 +1,7 @@ # # spec file for package libftdi1 # -# Copyright (c) 2026 SUSE LLC +# Copyright (c) 2026 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -26,6 +26,10 @@ Group: Hardware/Other URL: https://www.intra2net.com/en/developer/libftdi Source: libftdi1-%{version}.tar.xz +# PATCH-FIX-UPSTREAM libftdi1-swig-4.5-python3-api.patch -- typemaps used +# PyInt_AsLong(), which only worked via SWIG's Python 2 compat macros; +# SWIG 4.5.0 removed them +Patch0: libftdi1-swig-4.5-python3-api.patch BuildRequires: cmake >= 2.8 BuildRequires: doxygen BuildRequires: gcc-c++ ++++++ libftdi1-swig-4.5-python3-api.patch ++++++ >From ba2f57104fa5efc51fe006e7cad07ea1e087c1d7 Mon Sep 17 00:00:00 2001 From: Martin Pluskal <[email protected]> Date: Thu, 6 Aug 2026 13:39:24 +0200 Subject: [PATCH] python: do not rely on SWIG's Python 2 compatibility macros The (unsigned char *buf, int size) input typemaps call PyInt_AsLong() unguarded. That only ever compiled because SWIG emitted a Python 2 compatibility macro mapping it onto PyLong_AsLong() in the generated wrapper. SWIG 4.5.0 drops Python 2 support and removes those macros, so the generated ftdi1PYTHON_wrap.c now fails to build: ftdi1PYTHON_wrap.c:3985:10: error: implicit declaration of function 'PyInt_AsLong'; did you mean 'PyLong_AsLong'? Add a pyobj2long() helper guarded by PY_MAJOR_VERSION, matching the existing charp2str()/str2charp_size() helpers in this file, and use it in both typemaps. Python 2 behaviour is unchanged. --- python/ftdi1.i | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/python/ftdi1.i b/python/ftdi1.i index fac4d16..aa05d92 100644 --- a/python/ftdi1.i +++ b/python/ftdi1.i @@ -31,6 +31,15 @@ char * str2charp_size(PyObject* pyObj, int * size) *size = len; return v_; } + +inline long pyobj2long(PyObject* pyObj) +{ +#if PY_MAJOR_VERSION >= 3 + return PyLong_AsLong(pyObj); +#else + return PyInt_AsLong(pyObj); +#endif +} %} %include <typemaps.i> @@ -91,7 +100,7 @@ char * str2charp_size(PyObject* pyObj, int * size) "read_data(context) -> (return_code, buf)" %enddef %feature("autodoc", ftdi_read_data_docstring) ftdi_read_data; -%typemap(in,numinputs=1) (unsigned char *buf, int size) %{ $2 = PyInt_AsLong($input);$1 = (unsigned char*)malloc($2*sizeof(char)); %} +%typemap(in,numinputs=1) (unsigned char *buf, int size) %{ $2 = pyobj2long($input);$1 = (unsigned char*)malloc($2*sizeof(char)); %} %typemap(argout,noblock=1) (unsigned char *buf, int size) { if(result<0) $2=0; @@ -136,7 +145,7 @@ char * str2charp_size(PyObject* pyObj, int * size) int ftdi_get_eeprom_value(struct ftdi_context *ftdi, enum ftdi_eeprom_value value_name, int* value); %clear int* value; -%typemap(in,numinputs=1) (unsigned char *buf, int size) %{ $2 = PyInt_AsLong($input);$1 = (unsigned char*)malloc($2*sizeof(char)); %} +%typemap(in,numinputs=1) (unsigned char *buf, int size) %{ $2 = pyobj2long($input);$1 = (unsigned char*)malloc($2*sizeof(char)); %} %typemap(argout,noblock=1) (unsigned char *buf, int size) { if(result<0) $2=0; -- 2.51.0
