64 lines
1.9 KiB
Diff
64 lines
1.9 KiB
Diff
From 170f8550b89c6c9e61b40e782cd75148825c2e89 Mon Sep 17 00:00:00 2001
|
|
From: Michael Schroeder <mls@suse.de>
|
|
Date: Mon, 16 Nov 2020 13:45:13 +0100
|
|
Subject: [PATCH] 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
|
|
---
|
|
bindings/solv.i | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/bindings/solv.i b/bindings/solv.i
|
|
index 48d3f1fb..0a8389a2 100644
|
|
--- a/bindings/solv.i
|
|
+++ b/bindings/solv.i
|
|
@@ -44,7 +44,11 @@ typedef struct {
|
|
#if defined(SWIGPYTHON)
|
|
const void *pybuf = 0;
|
|
Py_ssize_t pysize = 0;
|
|
+#if PY_VERSION_HEX >= 0x03000000
|
|
+ res = PyBytes_AsStringAndSize($input, &pybuf, &pysize);
|
|
+#else
|
|
res = PyObject_AsReadBuffer($input, &pybuf, &pysize);
|
|
+#endif
|
|
if (res < 0) {
|
|
%argument_fail(res, "BinaryBlob", $symname, $argnum);
|
|
} else {
|
|
|
|
From e258226c2430db4f37a34c71e72b2d909fa407fe Mon Sep 17 00:00:00 2001
|
|
From: Michael Schroeder <mls@suse.de>
|
|
Date: Mon, 16 Nov 2020 15:11:14 +0100
|
|
Subject: [PATCH] Properly escape preprocessor directives
|
|
|
|
Otherwise swig will process them instead of the compiler
|
|
|
|
Should have been in commit 170f8550b89c6c9e61b40e782cd75148825c2e89
|
|
---
|
|
bindings/solv.i | 8 ++++----
|
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/bindings/solv.i b/bindings/solv.i
|
|
index 0a8389a2..1882b135 100644
|
|
--- a/bindings/solv.i
|
|
+++ b/bindings/solv.i
|
|
@@ -44,11 +44,11 @@ typedef struct {
|
|
#if defined(SWIGPYTHON)
|
|
const void *pybuf = 0;
|
|
Py_ssize_t pysize = 0;
|
|
-#if PY_VERSION_HEX >= 0x03000000
|
|
- res = PyBytes_AsStringAndSize($input, &pybuf, &pysize);
|
|
-#else
|
|
+%#if PY_VERSION_HEX >= 0x03000000
|
|
+ res = PyBytes_AsStringAndSize($input, (char **)&pybuf, &pysize);
|
|
+%#else
|
|
res = PyObject_AsReadBuffer($input, &pybuf, &pysize);
|
|
-#endif
|
|
+%#endif
|
|
if (res < 0) {
|
|
%argument_fail(res, "BinaryBlob", $symname, $argnum);
|
|
} else {
|