vtk/4490.patch
Orion Poplawski 1a2f805dad Update to 8.1.1
Use Qt 5
Use Python 3
2018-10-26 19:35:12 -06:00

41 lines
1.2 KiB
Diff

From 706f1b397df09a27ab8981ab9464547028d0c322 Mon Sep 17 00:00:00 2001
From: David Gobbi <david.gobbi@gmail.com>
Date: Wed, 11 Jul 2018 17:14:50 -0600
Subject: [PATCH] Fix compilation issue due to Python3.7 API change
The PyUnicode_AsUTF8() method returns a "const char *" in Py37.
---
Wrapping/PythonCore/vtkPythonArgs.cxx | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
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
--
2.18.1