Ticket #60381: patch-python38-compat.diff

File patch-python38-compat.diff, 8.2 KB (added by rubendibattista (Ruben Di Battista), 4 years ago)

Patch for Python38 compatibility

  • Utilities/PythonInterpreter/vtkPythonStdStreamCaptureHelper.h

    From 00e84cfcc5a0812503b431238fc26c349b0d714f Mon Sep 17 00:00:00 2001
    From: David Gobbi <david.gobbi@gmail.com>
    Date: Tue, 20 Aug 2019 17:02:24 -0600
    Subject: [PATCH] Compatibility for Python 3.8
    
    The PyTypeObject struct was modified in Python 3.8, this change is
    required to avoid compile errors.
    ---
     Utilities/PythonInterpreter/vtkPythonStdStreamCaptureHelper.h | 6 ++++++
     Wrapping/PythonCore/PyVTKMethodDescriptor.cxx                 | 2 +-
     Wrapping/PythonCore/PyVTKNamespace.cxx                        | 2 +-
     Wrapping/PythonCore/PyVTKReference.cxx                        | 8 ++++----
     Wrapping/PythonCore/PyVTKTemplate.cxx                         | 2 +-
     Wrapping/PythonCore/vtkPythonCompatibility.h                  | 8 +++++++-
     Wrapping/Tools/vtkWrapPythonClass.c                           | 2 +-
     Wrapping/Tools/vtkWrapPythonEnum.c                            | 2 +-
     Wrapping/Tools/vtkWrapPythonType.c                            | 2 +-
     9 files changed, 23 insertions(+), 11 deletions(-)
    
    diff --git a/Utilities/PythonInterpreter/vtkPythonStdStreamCaptureHelper.h b/Utilities/PythonInterpreter/vtkPythonStdStreamCaptureHelper.h
    index b1c12c8..14ccfbe 100644
    static PyTypeObject vtkPythonStdStreamCaptureHelperType = { 
    140140#if PY_VERSION_HEX >= 0x03040000
    141141  0, // tp_finalize
    142142#endif
     143#if PY_VERSION_HEX >= 0x03080000
     144  0, // tp_vectorcall
     145#if PY_VERSION_HEX < 0x03090000
     146  0, // tp_print
     147#endif
     148#endif
    143149};
    144150
    145151static PyObject* vtkWrite(PyObject* self, PyObject* args)
  • Wrapping/PythonCore/PyVTKMethodDescriptor.cxx

    diff --git a/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx b/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx
    index 2b0d443..3840038 100644
    PyTypeObject PyVTKMethodDescriptor_Type = { 
    186186  sizeof(PyMethodDescrObject),           // tp_basicsize
    187187  0,                                     // tp_itemsize
    188188  PyVTKMethodDescriptor_Delete,          // tp_dealloc
    189   nullptr,                               // tp_print
     189  0,                                     // tp_vectorcall_offset
    190190  nullptr,                               // tp_getattr
    191191  nullptr,                               // tp_setattr
    192192  nullptr,                               // tp_compare
  • Wrapping/PythonCore/PyVTKNamespace.cxx

    diff --git a/Wrapping/PythonCore/PyVTKNamespace.cxx b/Wrapping/PythonCore/PyVTKNamespace.cxx
    index 71ee2a3..5cf5bfb 100644
    PyTypeObject PyVTKNamespace_Type = { 
    4949  0,                                     // tp_basicsize
    5050  0,                                     // tp_itemsize
    5151  PyVTKNamespace_Delete,                 // tp_dealloc
    52   nullptr,                               // tp_print
     52  0,                                     // tp_vectorcall_offset
    5353  nullptr,                               // tp_getattr
    5454  nullptr,                               // tp_setattr
    5555  nullptr,                               // tp_compare
  • Wrapping/PythonCore/PyVTKReference.cxx

    diff --git a/Wrapping/PythonCore/PyVTKReference.cxx b/Wrapping/PythonCore/PyVTKReference.cxx
    index 943ac71..b710409 100644
    PyTypeObject PyVTKReference_Type = { 
    10101010  sizeof(PyVTKReference),                // tp_basicsize
    10111011  0,                                     // tp_itemsize
    10121012  PyVTKReference_Delete,                 // tp_dealloc
    1013   nullptr,                               // tp_print
     1013  0,                                     // tp_vectorcall_offset
    10141014  nullptr,                               // tp_getattr
    10151015  nullptr,                               // tp_setattr
    10161016  nullptr,                               // tp_compare
    PyTypeObject PyVTKNumberReference_Type = { 
    10671067  sizeof(PyVTKReference),                // tp_basicsize
    10681068  0,                                     // tp_itemsize
    10691069  PyVTKReference_Delete,                 // tp_dealloc
    1070   nullptr,                               // tp_print
     1070  0,                                     // tp_vectorcall_offset
    10711071  nullptr,                               // tp_getattr
    10721072  nullptr,                               // tp_setattr
    10731073  nullptr,                               // tp_compare
    PyTypeObject PyVTKStringReference_Type = { 
    11241124  sizeof(PyVTKReference),                // tp_basicsize
    11251125  0,                                     // tp_itemsize
    11261126  PyVTKReference_Delete,                 // tp_dealloc
    1127   nullptr,                               // tp_print
     1127  0,                                     // tp_vectorcall_offset
    11281128  nullptr,                               // tp_getattr
    11291129  nullptr,                               // tp_setattr
    11301130  nullptr,                               // tp_compare
    PyTypeObject PyVTKTupleReference_Type = { 
    11811181  sizeof(PyVTKReference),                // tp_basicsize
    11821182  0,                                     // tp_itemsize
    11831183  PyVTKReference_Delete,                 // tp_dealloc
    1184   nullptr,                               // tp_print
     1184  0,                                     // tp_vectorcall_offset
    11851185  nullptr,                               // tp_getattr
    11861186  nullptr,                               // tp_setattr
    11871187  nullptr,                               // tp_compare
  • Wrapping/PythonCore/PyVTKTemplate.cxx

    diff --git a/Wrapping/PythonCore/PyVTKTemplate.cxx b/Wrapping/PythonCore/PyVTKTemplate.cxx
    index be20098..340fe79 100644
    PyTypeObject PyVTKTemplate_Type = { 
    268268  0,                                     // tp_basicsize
    269269  0,                                     // tp_itemsize
    270270  nullptr,                               // tp_dealloc
    271   nullptr,                               // tp_print
     271  0,                                     // tp_vectorcall_offset
    272272  nullptr,                               // tp_getattr
    273273  nullptr,                               // tp_setattr
    274274  nullptr,                               // tp_compare
  • Wrapping/PythonCore/vtkPythonCompatibility.h

    diff --git a/Wrapping/PythonCore/vtkPythonCompatibility.h b/Wrapping/PythonCore/vtkPythonCompatibility.h
    index 4a76784..be208fa 100644
     
    6464#endif
    6565
    6666// PyTypeObject compatibility
    67 #if PY_VERSION_HEX >= 0x03040000
     67#if PY_VERSION_HEX >= 0x03090000
     68#define VTK_WRAP_PYTHON_SUPPRESS_UNINITIALIZED \
     69  0, 0, 0, 0,
     70#elif PY_VERSION_HEX >= 0x03080000
     71#define VTK_WRAP_PYTHON_SUPPRESS_UNINITIALIZED \
     72  0, 0, 0, 0, 0,
     73#elif PY_VERSION_HEX >= 0x03040000
    6874#define VTK_WRAP_PYTHON_SUPPRESS_UNINITIALIZED \
    6975  0, 0, 0,
    7076#else
  • Wrapping/Tools/vtkWrapPythonClass.c

    diff --git a/Wrapping/Tools/vtkWrapPythonClass.c b/Wrapping/Tools/vtkWrapPythonClass.c
    index b1e45f8..4d558ea 100644
    void vtkWrapPython_GenerateObjectType( 
    521521    "  sizeof(PyVTKObject), // tp_basicsize\n"
    522522    "  0, // tp_itemsize\n"
    523523    "  PyVTKObject_Delete, // tp_dealloc\n"
    524     "  nullptr, // tp_print\n"
     524    "  0, // tp_vectorcall_offset\n"
    525525    "  nullptr, // tp_getattr\n"
    526526    "  nullptr, // tp_setattr\n"
    527527    "  nullptr, // tp_compare\n"
  • Wrapping/Tools/vtkWrapPythonEnum.c

    diff --git a/Wrapping/Tools/vtkWrapPythonEnum.c b/Wrapping/Tools/vtkWrapPythonEnum.c
    index b933702..1249362 100644
    void vtkWrapPython_GenerateEnumType( 
    145145    "  sizeof(PyIntObject), // tp_basicsize\n"
    146146    "  0, // tp_itemsize\n"
    147147    "  nullptr, // tp_dealloc\n"
    148     "  nullptr, // tp_print\n"
     148    "  0, // tp_vectorcall_offset\n"
    149149    "  nullptr, // tp_getattr\n"
    150150    "  nullptr, // tp_setattr\n"
    151151    "  nullptr, // tp_compare\n"
  • Wrapping/Tools/vtkWrapPythonType.c

    diff --git a/Wrapping/Tools/vtkWrapPythonType.c b/Wrapping/Tools/vtkWrapPythonType.c
    index 744cb1b..0a1375e 100644
    void vtkWrapPython_GenerateSpecialType( 
    709709    "  sizeof(PyVTKSpecialObject), // tp_basicsize\n"
    710710    "  0, // tp_itemsize\n"
    711711    "  Py%s_Delete, // tp_dealloc\n"
    712     "  nullptr, // tp_print\n"
     712    "  0, // tp_vectorcall_offset\n"
    713713    "  nullptr, // tp_getattr\n"
    714714    "  nullptr, // tp_setattr\n"
    715715    "  nullptr, // tp_compare\n"