Commit 706f1b39 authored by David Gobbi's avatar David Gobbi

Fix compilation issue due to Python3.7 API change

The PyUnicode_AsUTF8() method returns a "const char *" in Py37.
parent cd3ffe5b
...@@ -95,13 +95,21 @@ bool vtkPythonGetStringValue(PyObject *o, T *&a, const char *exctext) ...@@ -95,13 +95,21 @@ bool vtkPythonGetStringValue(PyObject *o, T *&a, const char *exctext)
{ {
if (PyBytes_Check(o)) if (PyBytes_Check(o))
{ {
#if PY_VERSION_HEX >= 0x03070000
a = const_cast<char *>(PyBytes_AS_STRING(o));
return true;
#else
a = PyBytes_AS_STRING(o); a = PyBytes_AS_STRING(o);
return true; return true;
#endif
} }
#ifdef Py_USING_UNICODE #ifdef Py_USING_UNICODE
else if (PyUnicode_Check(o)) else if (PyUnicode_Check(o))
{ {
#if PY_VERSION_HEX >= 0x03030000 #if PY_VERSION_HEX >= 0x03070000
a = const_cast<char *>(PyUnicode_AsUTF8(o));
return true;
#elif PY_VERSION_HEX >= 0x03030000
a = PyUnicode_AsUTF8(o); a = PyUnicode_AsUTF8(o);
return true; return true;
#else #else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment