Commit 162ad2c7 authored by David E. DeMarle's avatar David E. DeMarle Committed by Kitware Robot

Merge topic '17350-python37-fix' into release

706f1b39 Fix compilation issue due to Python3.7 API change
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: David E. DeMarle's avatarDavid E. DeMarle <dave.demarle@kitware.com>
Merge-request: !4490
parents 2b149663 706f1b39
...@@ -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