Skip to content
  • David Gobbi's avatar
    Safe wrapping of non-const char pointer arguments · 8837686f
    David Gobbi authored
    Previously, the contents of a Python 'str' would be passed
    directly to C++ methods that took non-const 'char *' arguments.
    This was bad, since 'str' is immutable but there was no guarantee
    that the C++ method wouldn't try to modify the string.  Now the
    C++ method receives a copy of the Python string for 'char *' args
    and only directly receives the contents for 'const char *' args.
    If a bytearray or other mutable sequence is passed as 'char *',
    then the wrappers will write any modifications back to Python.
    
    In Python 3.7 the PyUnicode_AsUTF8() method was changed so that
    it returns "const char *" instead of returning "char *", so this
    commit is needed in order to compile VTK with Python 3.7.
    8837686f