Skip to content

Commit e8b564a

Browse files
authored
Merge pull request #462 from ignatenkobrain/pyssize_t
Fix compatibility with Python 3.10
2 parents 7c8ad2e + cbf6683 commit e8b564a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

bindings/solv.i

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
%markfunc Pool "mark_Pool";
1111
#endif
1212

13+
#ifdef SWIGPYTHON
14+
%begin %{
15+
#define PY_SSIZE_T_CLEAN
16+
%}
17+
#endif
18+
1319
/**
1420
** binaryblob handling
1521
**/
@@ -69,7 +75,7 @@ typedef struct {
6975

7076
%typemap(out,noblock=1,fragment="SWIG_FromCharPtrAndSize") BinaryBlob {
7177
#if defined(SWIGPYTHON) && defined(PYTHON3)
72-
$result = $1.data ? Py_BuildValue("y#", $1.data, $1.len) : SWIG_Py_Void();
78+
$result = $1.data ? Py_BuildValue("y#", $1.data, (Py_ssize_t)$1.len) : SWIG_Py_Void();
7379
#elif defined(SWIGTCL)
7480
Tcl_SetObjResult(interp, $1.data ? Tcl_NewByteArrayObj($1.data, $1.len) : NULL);
7581
#else

0 commit comments

Comments
 (0)