Don't restrict wrapped char to ASCII values
Previously, if a VTK methods returned a 'char' value that with an extended (non-ASCII) value, the Python wrappers would raise an exception: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0 Likewise, passing a Python str of length 1 to a VTK method as a 'char' would give an error if the unicode value was > 127: TypeError: InsertNextValue argument 1: a string of length 1 is required (Note: this should be a ValueError exception rather than TypeError.) The new code allows unicode values in the range [0,255] to be passed and returned with the Python wrappers.
Showing
- Documentation/docs/advanced/PythonWrappers.md 2 additions, 2 deletionsDocumentation/docs/advanced/PythonWrappers.md
- Wrapping/Python/Testing/Python/CMakeLists.txt 1 addition, 0 deletionsWrapping/Python/Testing/Python/CMakeLists.txt
- Wrapping/Python/Testing/Python/TestChar.py 55 additions, 0 deletionsWrapping/Python/Testing/Python/TestChar.py
- Wrapping/PythonCore/vtkPythonArgs.cxx 17 additions, 2 deletionsWrapping/PythonCore/vtkPythonArgs.cxx
- Wrapping/PythonCore/vtkPythonArgs.h 13 additions, 3 deletionsWrapping/PythonCore/vtkPythonArgs.h
Loading
Please register or sign in to comment