Skip to content

Assert should compare same type

In a python plugin using default_attributes on a vector property decorator, an assertion incorrectly fails because of a string to int comparison.

As a note, using the raw xml works as expected.

Generic Warning: In vtkPVPythonAlgorithmPlugin.cxx, line 184
Failed to load Python plugin:
Failed to call `paraview.detail.pythonalgorithm.load_plugin`.

Traceback (most recent call last):
  File "/home/nicolas/ParaView/master/build/lib/python3.10/site-packages/paraview/detail/pythonalgorithm.py", line 509, in load_plugin
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/nicolas/PVCourse/Exercises/Plugins/Python/Solution/PythonPlugin.py", line 8, in <module>
    class LineIntegrator(VTKPythonAlgorithmBase):
  File "/home/nicolas/PVCourse/Exercises/Plugins/Python/Solution/PythonPlugin.py", line 65, in LineIntegrator
    def SetString(self, value):
  File "/home/nicolas/ParaView/master/build/lib/python3.10/site-packages/paraview/detail/pythonalgorithm.py", line 76, in decorator
    updated_attrs = update_func(original_func, attrs)
  File "/home/nicolas/ParaView/master/build/lib/python3.10/site-packages/paraview/detail/pythonalgorithm.py", line 144, in _update_vectorproperty_defaults
    assert attrs["number_of_elements"] == _count(attrs["default_values"])
AssertionError
ERROR: In vtkPVPluginLoader.cxx, line 536
vtkPVPluginLoader (0x563321605ad0): /home/nicolas/PVCourse/Exercises/Plugins/Python/Solution/PythonPlugin.py: /home/nicolas/PVCourse/Exercises/Plugins/Python/Solution/PythonPlugin.py: invalid ELF header

Merge request reports