From: Igor Raits Date: Sun, 18 Jul 2021 16:47:05 +0000 (+0200) Subject: Fix compatibility with Python 3.10 X-Git-Tag: 0.7.20~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F462%2Fhead;p=thirdparty%2Flibsolv.git Fix compatibility with Python 3.10 Fixes: https://github.com/openSUSE/libsolv/issues/461 Signed-off-by: Igor Raits --- diff --git a/bindings/solv.i b/bindings/solv.i index 3bbeca04..abfb5e15 100644 --- a/bindings/solv.i +++ b/bindings/solv.i @@ -10,6 +10,12 @@ %markfunc Pool "mark_Pool"; #endif +#ifdef SWIGPYTHON +%begin %{ +#define PY_SSIZE_T_CLEAN +%} +#endif + /** ** binaryblob handling **/ @@ -69,7 +75,7 @@ typedef struct { %typemap(out,noblock=1,fragment="SWIG_FromCharPtrAndSize") BinaryBlob { #if defined(SWIGPYTHON) && defined(PYTHON3) - $result = $1.data ? Py_BuildValue("y#", $1.data, $1.len) : SWIG_Py_Void(); + $result = $1.data ? Py_BuildValue("y#", $1.data, (Py_ssize_t)$1.len) : SWIG_Py_Void(); #elif defined(SWIGTCL) Tcl_SetObjResult(interp, $1.data ? Tcl_NewByteArrayObj($1.data, $1.len) : NULL); #else