summaryrefslogtreecommitdiff
path: root/media-libs/vigra/files/vigra-1.11.1-python3.7.patch
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/vigra/files/vigra-1.11.1-python3.7.patch')
-rw-r--r--media-libs/vigra/files/vigra-1.11.1-python3.7.patch30
1 files changed, 30 insertions, 0 deletions
diff --git a/media-libs/vigra/files/vigra-1.11.1-python3.7.patch b/media-libs/vigra/files/vigra-1.11.1-python3.7.patch
new file mode 100644
index 000000000000..2e6cd3469f8e
--- /dev/null
+++ b/media-libs/vigra/files/vigra-1.11.1-python3.7.patch
@@ -0,0 +1,30 @@
+From a6fa62663c6a6b752ed0707e95f643e25867a0f9 Mon Sep 17 00:00:00 2001
+From: John Kirkham <kirkhamj@janelia.hhmi.org>
+Date: Fri, 19 Oct 2018 11:32:42 -0400
+Subject: [PATCH] Receive `const char *` from `PyUnicode_AsUTF8`
+
+In Python 3.7, `PyUnicode_AsUTF8` was changed to return a `const char *`
+instead of a `char *`. This broke VIGRA as we were accepting a `char *`
+in this case instead. Fortunately we do not need it to be mutable for
+our use case. So just type the variable storing the result from
+`PyUnicode_AsUTF8` as a `const char *`. Should still work on older
+Python 3 versions that return `char *` as well.
+
+ref: https://bugs.python.org/issue28769
+---
+ vigranumpy/src/core/vigranumpycore.cxx | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/vigranumpy/src/core/vigranumpycore.cxx b/vigranumpy/src/core/vigranumpycore.cxx
+index ec38d3636..c81c6ae52 100644
+--- a/vigranumpy/src/core/vigranumpycore.cxx
++++ b/vigranumpy/src/core/vigranumpycore.cxx
+@@ -61,7 +61,7 @@ UInt32 pychecksum(python::str const & s)
+ return checksum(data, size);
+ #else
+ Py_ssize_t size = 0;
+- char * data = PyUnicode_AsUTF8AndSize(s.ptr(), &size);
++ const char * data = PyUnicode_AsUTF8AndSize(s.ptr(), &size);
+ return checksum(data, size);
+ #endif
+ }