spack/var/spack/repos/builtin/packages/vtk/python3.7-const-char.patch
Ruben Di Battista d1db12e153 vtk: add support for Xdmf IO. (#9510)
* vtk: add variants for Xdmf IO support, ffmpeg support, and MPI
* vtk: depends on boost when Xdmf support is enabled
* vtk: add backported patch for python3.7
* vtk: New policy only for cmake >= 3.12
* mesa: add py-argparse dependency (for build)
* lz4: use MOREFLAGS instead of LIBS to add -lrt
2018-10-18 10:18:05 -07:00

28 lines
799 B
Diff

diff --git a/Wrapping/PythonCore/vtkPythonArgs.cxx b/Wrapping/PythonCore/vtkPythonArgs.cxx
index 1a82af0802..b733458975 100644
--- a/Wrapping/PythonCore/vtkPythonArgs.cxx
+++ b/Wrapping/PythonCore/vtkPythonArgs.cxx
@@ -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