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)
{
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);
return true;
#endif
}
#ifdef Py_USING_UNICODE
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);
return true;
#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