Skip to content

Commit 170f855

Browse files
committed
Use PyBytes_AsStringAndSize() instead of PyObject_AsReadBuffer() for python3
PyObject_AsReadBuffer was deprecated since python-3.0 and has now been removed in python-3.10. Fixes issue #410
1 parent 958c839 commit 170f855

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

bindings/solv.i

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ typedef struct {
4444
#if defined(SWIGPYTHON)
4545
const void *pybuf = 0;
4646
Py_ssize_t pysize = 0;
47+
#if PY_VERSION_HEX >= 0x03000000
48+
res = PyBytes_AsStringAndSize($input, &pybuf, &pysize);
49+
#else
4750
res = PyObject_AsReadBuffer($input, &pybuf, &pysize);
51+
#endif
4852
if (res < 0) {
4953
%argument_fail(res, "BinaryBlob", $symname, $argnum);
5054
} else {

0 commit comments

Comments
 (0)