From cef59ad0bf42d9ce14da4900d128b593ebba4dc3 Mon Sep 17 00:00:00 2001 From: kwryankrattiger <80296582+kwryankrattiger@users.noreply.github.com> Date: Mon, 28 Aug 2023 16:56:31 -0500 Subject: [PATCH] Patch VTK to enable python 3.8 in VTK 8.2 (#38735) * VTK: Add patch for python 3.8 support * CI: Re-enable VisIt in CI * Configure spec matrix for stack with VisIt * Add pugixml dep for 8.2.0 * Make VTK and ParaView consistent on proj dep * OpenMPI 3: provides MP support by default * Add details on proj dep in ParaView * Add python 3.8 to test mock repo * Patches to get VisIt VTK interface * CI: Disable VisIt with GUI in DAV --- .../cloud_pipelines/configs/packages.yaml | 25 +- .../stacks/data-vis-sdk/spack.yaml | 75 +++--- .../builtin.mock/packages/python/package.py | 1 + .../packages/ecp-data-vis-sdk/package.py | 3 +- .../packages/hdf5-vol-async/package.py | 3 +- .../builtin/packages/paraview/package.py | 1 + .../repos/builtin/packages/visit/package.py | 6 +- .../packages/visit/vtk-8.2-constcorrect.patch | 83 +++++++ .../repos/builtin/packages/vtk/package.py | 33 ++- .../packages/vtk/vtk-8.2-exodusII-gcc11.patch | 11 + .../builtin/packages/vtk/vtk82_python38.patch | 231 ++++++++++++++++++ 11 files changed, 413 insertions(+), 59 deletions(-) create mode 100644 var/spack/repos/builtin/packages/visit/vtk-8.2-constcorrect.patch create mode 100644 var/spack/repos/builtin/packages/vtk/vtk-8.2-exodusII-gcc11.patch create mode 100644 var/spack/repos/builtin/packages/vtk/vtk82_python38.patch diff --git a/share/spack/gitlab/cloud_pipelines/configs/packages.yaml b/share/spack/gitlab/cloud_pipelines/configs/packages.yaml index 12e2ed6b94..dbd945bc72 100644 --- a/share/spack/gitlab/cloud_pipelines/configs/packages.yaml +++ b/share/spack/gitlab/cloud_pipelines/configs/packages.yaml @@ -1,11 +1,14 @@ -packages: {} - -# CI should never build develop/main/master versions of packages. Current issues: -# - e4s/dav -# - hdf5-vol-async => argobot@main -# - aws-isc-aarch64 -# - sse2neon - -# packages: -# all: -# require: "@:999999999" \ No newline at end of file +packages: + #all: + # CI should never build develop/main/master versions of + # packages. + # Current issues: + # - e4s/dav + # - hdf5-vol-async => argobot@main + # - aws-isc-aarch64 + # - sse2neon + #require: "@:999999999" + python: + # This is required after https://github.com/spack/spack/pull/38619 + # to avoid concretizing deprecated python. + require: "@3.8:" diff --git a/share/spack/gitlab/cloud_pipelines/stacks/data-vis-sdk/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/data-vis-sdk/spack.yaml index 1a624c53ee..5c9946c7e2 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/data-vis-sdk/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/data-vis-sdk/spack.yaml @@ -3,51 +3,50 @@ spack: packages: cmake: variants: ~ownlibs + ecp-data-vis-sdk: + require: + - one_of: + - +ascent +adios2 +cinema +darshan +faodel +hdf5 +pnetcdf +sensei +sz +unifyfs + +veloc +vtkm +zfp + - one_of: + - +paraview ~visit + - ~paraview +visit + hdf5: + require: + - one_of: ['@1.14', '@1.12'] mesa: - require: "+glx +osmesa +opengl ~opengles +llvm" + require: +glx +osmesa +opengl ~opengles +llvm libosmesa: - require: "mesa +osmesa" + require: mesa +osmesa libglx: - require: "mesa +glx" + require: mesa +glx ospray: - require: "@2.8.0 +denoiser +mpi" + require: '@2.8.0 +denoiser +mpi' llvm: - require: "@14:" + require: '@14:' # Minimize LLVM - variants: "~lldb~lld~polly~gold libunwind=none compiler-rt=none" + variants: ~lldb~lld~polly~gold libunwind=none compiler-rt=none all: require: target=x86_64_v3 definitions: - paraview_specs: - matrix: - - - paraview - - - +qt~osmesa ^glew gl=glx # GUI Support w/ GLX Rendering - - ~qt~osmesa ^glew gl=glx # GLX Rendering - - ~qt+osmesa ^glew gl=osmesa # OSMesa Rendering + - - paraview +raytracing + - - +qt~osmesa # GUI Support w/ GLX Rendering + - ~qt~osmesa # GLX Rendering + - ~qt+osmesa # OSMesa Rendering - visit_specs: - matrix: - - visit - - - +gui~osmesa # GUI Support w/ GLX Rendering - - ~gui~osmesa # GLX Rendering + - - ~gui~osmesa # GLX Rendering - ~gui+osmesa # OSMesa Rendering + # VisIt GUI does not work with Qt 5.14.2 + # - +gui~osmesa # GUI Support w/ GLX Rendering - sdk_base_spec: - matrix: - - - ecp-data-vis-sdk - +ascent - +adios2 - +cinema - +darshan - +faodel - +hdf5 - +paraview - +pnetcdf - +sensei - +sz - +unifyfs - +veloc - +vtkm - +zfp + - - ecp-data-vis-sdk +ascent +adios2 +cinema +darshan +faodel +hdf5 +pnetcdf + +sensei +sz +unifyfs +veloc +vtkm +zfp - - ~cuda ~rocm # Current testing of GPU supported configurations # is provided in the E4S stack @@ -55,22 +54,20 @@ spack: # - ~cuda +rocm specs: - # Test ParaView builds with different GL backends - - matrix: - - [$sdk_base_spec] - - [$^paraview_specs] - - - ^hdf5@1.14 # Non-VisIt can build HDF5 1.14 - # Test ParaView builds with differnt GL backends - # - matrix: - # - [$sdk_base_spec] - # - [$^visit_specs] + # Test ParaView and VisIt builds with different GL backends + - matrix: + - [$sdk_base_spec] + - [$^paraview_specs] + - matrix: + - [$sdk_base_spec] + - [$^visit_specs] - mirrors: { "mirror": "s3://spack-binaries/develop/data-vis-sdk" } + mirrors: {mirror: s3://spack-binaries/develop/data-vis-sdk} ci: pipeline-gen: - build-job: - image: { "name": "ecpe4s/ubuntu20.04-runner-x86_64:2023-01-01", "entrypoint": [""] } + image: {name: ecpe4s/ubuntu20.04-runner-x86_64:2023-01-01, entrypoint: ['']} cdash: - build-group:: Data and Vis SDK + 'build-group:': Data and Vis SDK diff --git a/var/spack/repos/builtin.mock/packages/python/package.py b/var/spack/repos/builtin.mock/packages/python/package.py index 4ba957e050..9fbee0ec2e 100644 --- a/var/spack/repos/builtin.mock/packages/python/package.py +++ b/var/spack/repos/builtin.mock/packages/python/package.py @@ -14,6 +14,7 @@ class Python(Package): extendable = True + version("3.8.0", md5="d41d8cd98f00b204e9800998ecf8427e") version("3.7.1", md5="aaabbbcccdddeeefffaaabbbcccddd12") version("3.5.1", md5="be78e48cdfc1a7ad90efff146dce6cfe") version("3.5.0", md5="a56c0c0b45d75a0ec9c6dee933c41c36") diff --git a/var/spack/repos/builtin/packages/ecp-data-vis-sdk/package.py b/var/spack/repos/builtin/packages/ecp-data-vis-sdk/package.py index a9c33b7d5e..189515b056 100644 --- a/var/spack/repos/builtin/packages/ecp-data-vis-sdk/package.py +++ b/var/spack/repos/builtin/packages/ecp-data-vis-sdk/package.py @@ -171,8 +171,7 @@ class EcpDataVisSdk(BundlePackage, CudaPackage, ROCmPackage): # ParaView needs @5.11: in order to use CUDA/ROCM, therefore it is the minimum # required version since GPU capability is desired for ECP dav_sdk_depends_on( - "paraview@5.11:+mpi+openpmd+python+kits+shared+catalyst+libcatalyst+raytracing" - " use_vtkm=on", + "paraview@5.11:+mpi+openpmd+python+kits+shared+catalyst+libcatalyst" " use_vtkm=on", when="+paraview", propagate=["adios2", "cuda", "hdf5", "rocm"] + amdgpu_target_variants + cuda_arch_variants, ) diff --git a/var/spack/repos/builtin/packages/hdf5-vol-async/package.py b/var/spack/repos/builtin/packages/hdf5-vol-async/package.py index cc9ffaa8c2..59ce1eb970 100644 --- a/var/spack/repos/builtin/packages/hdf5-vol-async/package.py +++ b/var/spack/repos/builtin/packages/hdf5-vol-async/package.py @@ -35,7 +35,8 @@ class Hdf5VolAsync(CMakePackage): depends_on("hdf5@1.14.0: +mpi +threadsafe") # Require MPI_THREAD_MULTIPLE. - depends_on("openmpi +thread_multiple", when="^openmpi") + depends_on("openmpi +thread_multiple", when="^openmpi@:2") + depends_on("openmpi", when="^openmpi@3:") depends_on("mvapich2 threads=multiple", when="^mvapich2") def setup_run_environment(self, env): diff --git a/var/spack/repos/builtin/packages/paraview/package.py b/var/spack/repos/builtin/packages/paraview/package.py index 5220bb1fbe..757077e0e3 100644 --- a/var/spack/repos/builtin/packages/paraview/package.py +++ b/var/spack/repos/builtin/packages/paraview/package.py @@ -252,6 +252,7 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage): depends_on("nlohmann-json", when="@5.11:") # ParaView depends on proj@8.1.0 due to changes in MR + # v8.1.0 is required for VTK::GeoVis # https://gitlab.kitware.com/vtk/vtk/-/merge_requests/8474 depends_on("proj@8.1.0", when="@5.11:") diff --git a/var/spack/repos/builtin/packages/visit/package.py b/var/spack/repos/builtin/packages/visit/package.py index e9362d0183..ed8b2a8a45 100644 --- a/var/spack/repos/builtin/packages/visit/package.py +++ b/var/spack/repos/builtin/packages/visit/package.py @@ -98,6 +98,9 @@ class Visit(CMakePackage): # Fix pthread and librt link errors patch("visit32-missing-link-libs.patch", when="@3.2") + # Fix const-correctness in VTK interface + patch("vtk-8.2-constcorrect.patch", when="@3.3.3 ^vtk@8.2.1a") + # Exactly one of 'gui' or 'osmesa' has to be enabled conflicts("+gui", when="+osmesa") @@ -129,7 +132,8 @@ class Visit(CMakePackage): depends_on("qwt+opengl", when="+gui") # python@3.8 doesn't work with VisIt. - depends_on("python@3.2:3.7,3.9:", when="+python") + depends_on("python@3.2:3.7,3.9:", when="@:3.2 +python") + depends_on("python@3.2:", when="@3.3: +python") extends("python", when="+python") # VisIt uses the hdf5 1.8 api diff --git a/var/spack/repos/builtin/packages/visit/vtk-8.2-constcorrect.patch b/var/spack/repos/builtin/packages/visit/vtk-8.2-constcorrect.patch new file mode 100644 index 0000000000..2fed026d04 --- /dev/null +++ b/var/spack/repos/builtin/packages/visit/vtk-8.2-constcorrect.patch @@ -0,0 +1,83 @@ +diff --git a/src/visit_vtk/full/vtkCSGCell.C b/src/visit_vtk/full/vtkCSGCell.C +index fa89df8325..28e82a0b86 100644 +--- a/src/visit_vtk/full/vtkCSGCell.C ++++ b/src/visit_vtk/full/vtkCSGCell.C +@@ -11,7 +11,7 @@ + + vtkStandardNewMacro(vtkCSGCell); + +-int vtkCSGCell::EvaluatePosition(double vtkNotUsed(x)[3], ++int vtkCSGCell::EvaluatePosition(const double vtkNotUsed(x)[3], + double vtkNotUsed(closestPoint)[3], + int& vtkNotUsed(subId), + double vtkNotUsed(pcoords)[3], +@@ -22,14 +22,14 @@ int vtkCSGCell::EvaluatePosition(double vtkNotUsed(x)[3], + } + + void vtkCSGCell::EvaluateLocation(int& vtkNotUsed(subId), +- double vtkNotUsed(pcoords)[3], ++ const double vtkNotUsed(pcoords)[3], + double vtkNotUsed(x)[3], + double *vtkNotUsed(weights)) + { + } + + int vtkCSGCell::CellBoundary(int vtkNotUsed(subId), +- double vtkNotUsed(pcoords)[3], ++ const double vtkNotUsed(pcoords)[3], + vtkIdList *vtkNotUsed(pts)) + { + return 0; +@@ -47,8 +47,8 @@ vtkCSGCell::Clip(double, vtkDataArray*, vtkIncrementalPointLocator*, vtkCellArra + + // Project point on line. If it lies between 0<=t<=1 and distance off line + // is less than tolerance, intersection detected. +-int vtkCSGCell::IntersectWithLine(double vtkNotUsed(p1)[3], +- double vtkNotUsed(p2)[3], ++int vtkCSGCell::IntersectWithLine(const double vtkNotUsed(p1)[3], ++ const double vtkNotUsed(p2)[3], + double vtkNotUsed(tol), + double& vtkNotUsed(t), + double vtkNotUsed(x)[3], +@@ -69,8 +69,8 @@ int vtkCSGCell::Triangulate(int vtkNotUsed(index), + } + + void vtkCSGCell::Derivatives(int vtkNotUsed(subId), +- double vtkNotUsed(pcoords)[3], +- double *vtkNotUsed(values), ++ const double vtkNotUsed(pcoords)[3], ++ const double *vtkNotUsed(values), + int vtkNotUsed(dim), + double *vtkNotUsed(derivs)) + { +diff --git a/src/visit_vtk/full/vtkCSGCell.h b/src/visit_vtk/full/vtkCSGCell.h +index f8543cd822..b19f209f1e 100644 +--- a/src/visit_vtk/full/vtkCSGCell.h ++++ b/src/visit_vtk/full/vtkCSGCell.h +@@ -35,21 +35,21 @@ public: + int GetNumberOfFaces() override {return 0;}; + vtkCell *GetEdge(int) override {return 0;}; + vtkCell *GetFace(int) override {return 0;}; +- int CellBoundary(int subId, double pcoords[3], vtkIdList *pts) override; ++ int CellBoundary(int subId, const double pcoords[3], vtkIdList *pts) override; + + virtual void Contour(double, vtkDataArray*, vtkIncrementalPointLocator*, vtkCellArray*, vtkCellArray*, vtkCellArray*, vtkPointData*, vtkPointData*, vtkCellData*, vtkIdType, vtkCellData*) override; + + virtual void Clip(double, vtkDataArray*, vtkIncrementalPointLocator*, vtkCellArray*, vtkPointData*, vtkPointData*, vtkCellData*, vtkIdType, vtkCellData*, int) override; + +- int EvaluatePosition(double x[3], double* closestPoint, ++ int EvaluatePosition(const double x[3], double* closestPoint, + int& subId, double pcoords[3], + double& dist2, double *weights) override; +- void EvaluateLocation(int& subId, double pcoords[3], double x[3], ++ void EvaluateLocation(int& subId, const double pcoords[3], double x[3], + double *weights) override; +- int IntersectWithLine(double p1[3], double p2[3], double tol, double& t, ++ int IntersectWithLine(const double p1[3], const double p2[3], double tol, double& t, + double x[3], double pcoords[3], int& subId) override; + int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) override; +- void Derivatives(int subId, double pcoords[3], double *values, ++ void Derivatives(int subId, const double pcoords[3], const double *values, + int dim, double *derivs) override; + + protected: diff --git a/var/spack/repos/builtin/packages/vtk/package.py b/var/spack/repos/builtin/packages/vtk/package.py index 9f35aea845..27b757c2c3 100644 --- a/var/spack/repos/builtin/packages/vtk/package.py +++ b/var/spack/repos/builtin/packages/vtk/package.py @@ -27,6 +27,15 @@ class Vtk(CMakePackage): version("9.0.3", sha256="bc3eb9625b2b8dbfecb6052a2ab091fc91405de4333b0ec68f3323815154ed8a") version("9.0.1", sha256="1b39a5e191c282861e7af4101eaa8585969a2de05f5646c9199a161213a622c7") version("9.0.0", sha256="15def4e6f84d72f82386617fe595ec124dda3cbd13ea19a0dcd91583197d8715") + # v8.2.1a is a compatability version of VTK to allow VisIt to build in CI and contains + # patches that were not tested by VTK CI or for a VTK release + # - Python 3.8 compatability + # - VisIt 3.3.3 compatability + version( + "8.2.1a", + url="https://www.vtk.org/files/release/8.2/VTK-8.2.0.tar.gz", + sha256="34c3dc775261be5e45a8049155f7228b6bd668106c72a3c435d95730d17d57bb", + ) version("8.2.0", sha256="34c3dc775261be5e45a8049155f7228b6bd668106c72a3c435d95730d17d57bb") version("8.1.2", sha256="0995fb36857dd76ccfb8bb07350c214d9f9099e80b1e66b4a8909311f24ff0db") version("8.1.1", sha256="71a09b4340f0a9c58559fe946dc745ab68a866cf20636a41d97b6046cb736324") @@ -66,8 +75,9 @@ class Vtk(CMakePackage): with when("+python"): # Depend on any Python, add bounds below. extends("python@2.7:", type=("build", "run")) - # Python 3.8 support from vtk 9 - depends_on("python@:3.7", when="@:8", type=("build", "run")) + depends_on("python@:3.7", when="@:8.2.0", type=("build", "run")) + # Python 3.8 support from vtk 9 and patched 8.2 + depends_on("python@:3.8", when="@:8.2.1a", type=("build", "run")) # Python 3.10 support from vtk 9.2 depends_on("python@:3.9", when="@:9.1", type=("build", "run")) @@ -86,7 +96,15 @@ class Vtk(CMakePackage): # Fix IOADIOS2 module to work with kits # https://gitlab.kitware.com/vtk/vtk/-/merge_requests/8653 - patch("vtk-adios2-module-no-kit.patch", when="@8.2.0:9.0.3") + patch("vtk-adios2-module-no-kit.patch", when="@9:9.0.3") + + # Python 3.8 compatibility for VTK 8.2 + # https://gitlab.kitware.com/vtk/vtk/-/merge_requests/6269 + # https://gitlab.kitware.com/vtk/vtk/-/merge_requests/6275 + patch("vtk82_python38.patch", when="@8.2.1a") + + # Fix link error in exodusII + patch("vtk-8.2-exodusII-gcc11.patch", when="@8.2.1a") # The use of the OpenGL2 backend requires at least OpenGL Core Profile # version 3.2 or higher. @@ -137,13 +155,13 @@ class Vtk(CMakePackage): depends_on("eigen", when="@8.2.0:") depends_on("double-conversion", when="@8.2.0:") depends_on("sqlite", when="@8.2.0:") - depends_on("pugixml", when="@9:") + depends_on("pugixml", when="@8.2.0:") depends_on("libogg") depends_on("libtheora") depends_on("utf8cpp", when="@9:") depends_on("gl2ps", when="@8.1:") depends_on("gl2ps@1.4.1:", when="@9:") - depends_on("proj@4", when="@8.2") + depends_on("proj@4", when="@8.2.0") depends_on("proj@4:7", when="@9:") depends_on("cgns@4.1.1:+mpi", when="@9.1: +mpi") depends_on("cgns@4.1.1:~mpi", when="@9.1: ~mpi") @@ -201,6 +219,11 @@ def cmake_args(self): "-DVTK_ALL_NEW_OBJECT_FACTORY:BOOL=ON", ] + # Version 8.2.1a using internal libproj/pugixml for compatability + if spec.satisfies("@8.2.1a"): + cmake_args.append("-DVTK_USE_SYSTEM_LIBPROJ:BOOL=OFF") + cmake_args.append("-DVTK_USE_SYSTEM_PUGIXML:BOOL=OFF") + # Disable wrappers for other languages. cmake_args.append("-DVTK_WRAP_JAVA=OFF") if spec.satisfies("@:8.1"): diff --git a/var/spack/repos/builtin/packages/vtk/vtk-8.2-exodusII-gcc11.patch b/var/spack/repos/builtin/packages/vtk/vtk-8.2-exodusII-gcc11.patch new file mode 100644 index 0000000000..7208d8167c --- /dev/null +++ b/var/spack/repos/builtin/packages/vtk/vtk-8.2-exodusII-gcc11.patch @@ -0,0 +1,11 @@ +diff --git a/ThirdParty/exodusII/vtkexodusII/src/ex_create_par.c b/ThirdParty/exodusII/vtkexodusII/src/ex_create_par.c +index bf5bb44711..1fe5cd9737 100644 +--- a/ThirdParty/exodusII/vtkexodusII/src/ex_create_par.c ++++ b/ThirdParty/exodusII/vtkexodusII/src/ex_create_par.c +@@ -614,5 +614,5 @@ int ex_create_par_int(const char *path, int cmode, int *comp_ws, int *io_ws, MPI + * Prevent warning in some versions of ranlib(1) because the object + * file has no symbols. + */ +-const char exodus_unused_symbol_dummy_1; ++extern const char exodus_unused_symbol_dummy_1; + #endif diff --git a/var/spack/repos/builtin/packages/vtk/vtk82_python38.patch b/var/spack/repos/builtin/packages/vtk/vtk82_python38.patch new file mode 100644 index 0000000000..aea5b31c8b --- /dev/null +++ b/var/spack/repos/builtin/packages/vtk/vtk82_python38.patch @@ -0,0 +1,231 @@ +diff --git a/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx b/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx +index 2b0d443537..945767acc0 100644 +--- a/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx ++++ b/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx +@@ -186,7 +186,11 @@ PyTypeObject PyVTKMethodDescriptor_Type = { + sizeof(PyMethodDescrObject), // tp_basicsize + 0, // tp_itemsize + PyVTKMethodDescriptor_Delete, // tp_dealloc ++#if PY_VERSION_HEX >= 0x03080000 ++ 0, // tp_vectorcall_offseta ++#else + nullptr, // tp_print ++#endif + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +diff --git a/Wrapping/PythonCore/PyVTKNamespace.cxx b/Wrapping/PythonCore/PyVTKNamespace.cxx +index 71ee2a3516..ccc57db893 100644 +--- a/Wrapping/PythonCore/PyVTKNamespace.cxx ++++ b/Wrapping/PythonCore/PyVTKNamespace.cxx +@@ -49,7 +49,11 @@ PyTypeObject PyVTKNamespace_Type = { + 0, // tp_basicsize + 0, // tp_itemsize + PyVTKNamespace_Delete, // tp_dealloc ++#if PY_VERSION_HEX >= 0x03080000 ++ 0, // tp_vectorcall_offseta ++#else + nullptr, // tp_print ++#endif + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +diff --git a/Wrapping/PythonCore/PyVTKReference.cxx b/Wrapping/PythonCore/PyVTKReference.cxx +index 943ac71080..6e42309323 100644 +--- a/Wrapping/PythonCore/PyVTKReference.cxx ++++ b/Wrapping/PythonCore/PyVTKReference.cxx +@@ -1010,7 +1010,11 @@ PyTypeObject PyVTKReference_Type = { + sizeof(PyVTKReference), // tp_basicsize + 0, // tp_itemsize + PyVTKReference_Delete, // tp_dealloc ++#if PY_VERSION_HEX >= 0x03080000 ++ 0, // tp_vectorcall_offseta ++#else + nullptr, // tp_print ++#endif + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +@@ -1067,7 +1071,11 @@ PyTypeObject PyVTKNumberReference_Type = { + sizeof(PyVTKReference), // tp_basicsize + 0, // tp_itemsize + PyVTKReference_Delete, // tp_dealloc ++#if PY_VERSION_HEX >= 0x03080000 ++ 0, // tp_vectorcall_offseta ++#else + nullptr, // tp_print ++#endif + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +@@ -1124,7 +1132,11 @@ PyTypeObject PyVTKStringReference_Type = { + sizeof(PyVTKReference), // tp_basicsize + 0, // tp_itemsize + PyVTKReference_Delete, // tp_dealloc ++#if PY_VERSION_HEX >= 0x03080000 ++ 0, // tp_vectorcall_offseta ++#else + nullptr, // tp_print ++#endif + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +@@ -1181,7 +1193,11 @@ PyTypeObject PyVTKTupleReference_Type = { + sizeof(PyVTKReference), // tp_basicsize + 0, // tp_itemsize + PyVTKReference_Delete, // tp_dealloc ++#if PY_VERSION_HEX >= 0x03080000 ++ 0, // tp_vectorcall_offseta ++#else + nullptr, // tp_print ++#endif + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +diff --git a/Wrapping/PythonCore/PyVTKTemplate.cxx b/Wrapping/PythonCore/PyVTKTemplate.cxx +index be200985b3..73993e6ad7 100644 +--- a/Wrapping/PythonCore/PyVTKTemplate.cxx ++++ b/Wrapping/PythonCore/PyVTKTemplate.cxx +@@ -268,7 +268,11 @@ PyTypeObject PyVTKTemplate_Type = { + 0, // tp_basicsize + 0, // tp_itemsize + nullptr, // tp_dealloc ++#if PY_VERSION_HEX >= 0x03080000 ++ 0, // tp_vectorcall_offseta ++#else + nullptr, // tp_print ++#endif + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +diff --git a/Wrapping/Tools/vtkWrapPythonClass.c b/Wrapping/Tools/vtkWrapPythonClass.c +index b1e45f8e80..f37ef1d17b 100644 +--- a/Wrapping/Tools/vtkWrapPythonClass.c ++++ b/Wrapping/Tools/vtkWrapPythonClass.c +@@ -521,7 +521,11 @@ void vtkWrapPython_GenerateObjectType( + " sizeof(PyVTKObject), // tp_basicsize\n" + " 0, // tp_itemsize\n" + " PyVTKObject_Delete, // tp_dealloc\n" ++ "#if PY_VERSION_HEX >= 0x03080000\n" ++ " 0, // tp_vectorcall_offset\n" ++ "#else\n" + " nullptr, // tp_print\n" ++ "#endif\n" + " nullptr, // tp_getattr\n" + " nullptr, // tp_setattr\n" + " nullptr, // tp_compare\n" +diff --git a/Wrapping/Tools/vtkWrapPythonEnum.c b/Wrapping/Tools/vtkWrapPythonEnum.c +index b933702242..a6d1a96384 100644 +--- a/Wrapping/Tools/vtkWrapPythonEnum.c ++++ b/Wrapping/Tools/vtkWrapPythonEnum.c +@@ -145,7 +145,11 @@ void vtkWrapPython_GenerateEnumType( + " sizeof(PyIntObject), // tp_basicsize\n" + " 0, // tp_itemsize\n" + " nullptr, // tp_dealloc\n" ++ "#if PY_VERSION_HEX >= 0x03080000\n" ++ " 0, // tp_vectorcall_offset\n" ++ "#else\n" + " nullptr, // tp_print\n" ++ "#endif\n" + " nullptr, // tp_getattr\n" + " nullptr, // tp_setattr\n" + " nullptr, // tp_compare\n" +diff --git a/Wrapping/Tools/vtkWrapPythonInit.c b/Wrapping/Tools/vtkWrapPythonInit.c +index d1eb3b890c..f89501f322 100644 +--- a/Wrapping/Tools/vtkWrapPythonInit.c ++++ b/Wrapping/Tools/vtkWrapPythonInit.c +@@ -54,7 +54,7 @@ static void CreateImplFile(const char *libName, + fprintf(fout,"#include \"vtkPython.h\"\n"); + fprintf(fout,"#include \"vtkPythonCompatibility.h\"\n"); + fprintf(fout,"#include \"vtkSystemIncludes.h\"\n"); +- fprintf(fout,"#include \n"); ++ fprintf(fout,"#include \n"); + fprintf(fout,"// Handle compiler warning messages, etc.\n" + "#if defined( _MSC_VER ) && !defined(VTK_DISPLAY_WIN32_WARNINGS)\n" + "#pragma warning ( disable : 4706 )\n" +diff --git a/Wrapping/Tools/vtkWrapPythonMethod.c b/Wrapping/Tools/vtkWrapPythonMethod.c +index 17d1a8cb2e..61a639ed38 100644 +--- a/Wrapping/Tools/vtkWrapPythonMethod.c ++++ b/Wrapping/Tools/vtkWrapPythonMethod.c +@@ -659,7 +659,7 @@ void vtkWrapPython_ReturnValue( + fprintf(fp, + " if (result && PyVTKObject_Check(result))\n" + " {\n" +- " PyVTKObject_GetObject(result)->UnRegister(0);\n" ++ " PyVTKObject_GetObject(result)->UnRegister(nullptr);\n" + " PyVTKObject_SetFlag(result, VTK_PYTHON_IGNORE_UNREGISTER, 1);\n" + " }\n"); + } +@@ -700,9 +700,7 @@ void vtkWrapPython_ReturnValue( + } + else if (vtkWrap_IsArray(val)) + { +- fprintf(fp, +- " result = %sBuildTuple(tempr, sizer);\n", +- prefix); ++ fprintf(fp, " result = vtkPythonArgs::BuildTuple(tempr, sizer);\n"); + } + else if (vtkWrap_IsStdVector(val)) + { +@@ -809,9 +807,8 @@ void vtkWrapPython_SaveArgs(FILE *fp, FunctionInfo *currentFunction) + { + noneDone = 0; + +- fprintf(fp, +- " ap.Save(%.*stemp%d, %.*ssave%d, ", +- (n-1), asterisks, i, (n-1), asterisks, i); ++ fprintf(fp, " vtkPythonArgs::Save(%.*stemp%d, %.*ssave%d, ", (n - 1), asterisks, i, ++ (n - 1), asterisks, i); + + if (vtkWrap_IsNArray(arg)) + { +@@ -1096,9 +1093,8 @@ static void vtkWrapPython_WriteBackToArgs( + !vtkWrap_IsConst(arg) && + !vtkWrap_IsSetVectorMethod(currentFunction)) + { +- fprintf(fp, +- " if (ap.HasChanged(%.*stemp%d, %.*ssave%d, ", +- (n-1), asterisks, i, (n-1), asterisks, i); ++ fprintf(fp, " if (vtkPythonArgs::HasChanged(%.*stemp%d, %.*ssave%d, ", (n - 1), asterisks, ++ i, (n - 1), asterisks, i); + + if (vtkWrap_IsNArray(arg)) + { +@@ -1140,7 +1136,7 @@ static void vtkWrapPython_WriteBackToArgs( + " {\n" + " PyObject *vec = (temp%d.size() == 0 ?\n" + " PyTuple_New(0) :\n" +- " ap.BuildTuple(temp%d.data(), temp%d.size()));\n" ++ " vtkPythonArgs::BuildTuple(temp%d.data(), temp%d.size()));\n" + " ap.SetContents(%d, vec);\n" + " Py_DECREF(vec);\n" + " }\n" +diff --git a/Wrapping/Tools/vtkWrapPythonMethodDef.c b/Wrapping/Tools/vtkWrapPythonMethodDef.c +index 8e9735f312..05cee2f740 100644 +--- a/Wrapping/Tools/vtkWrapPythonMethodDef.c ++++ b/Wrapping/Tools/vtkWrapPythonMethodDef.c +@@ -1038,7 +1038,7 @@ static void vtkWrapPython_CustomMethods( + " if (tempr != nullptr)\n" + " {\n" + " result = vtkPythonArgs::BuildVTKObject(tempr);\n" +- " PyVTKObject_GetObject(result)->UnRegister(0);\n" ++ " PyVTKObject_GetObject(result)->UnRegister(nullptr);\n" + " }\n" + " }\n" + "\n" +diff --git a/Wrapping/Tools/vtkWrapPythonType.c b/Wrapping/Tools/vtkWrapPythonType.c +index 744cb1b9d3..b7a7ea0d15 100644 +--- a/Wrapping/Tools/vtkWrapPythonType.c ++++ b/Wrapping/Tools/vtkWrapPythonType.c +@@ -709,7 +709,11 @@ void vtkWrapPython_GenerateSpecialType( + " sizeof(PyVTKSpecialObject), // tp_basicsize\n" + " 0, // tp_itemsize\n" + " Py%s_Delete, // tp_dealloc\n" ++ "#if PY_VERSION_HEX >= 0x03080000\n" ++ " 0, // tp_vectorcall_offset\n" ++ "#else\n" + " nullptr, // tp_print\n" ++ "#endif\n" + " nullptr, // tp_getattr\n" + " nullptr, // tp_setattr\n" + " nullptr, // tp_compare\n"