From a6fa62663c6a6b752ed0707e95f643e25867a0f9 Mon Sep 17 00:00:00 2001 From: John Kirkham 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 }