bpo-30708: Check for null characters in PyUnicode_AsWideCharString(). by serhiy-storchaka · Pull Request #2285 · python/cpython (original) (raw)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This exception is for the users of extensions, not for the authors of extensions. PyArg_ParseTuple()
raises the same exception, as well as some other functions. Using PyArg_ParseTuple()
or PyUnicode_AsWideCharString()
or other way for converting Python objects to C values is an implementation detail insignificant for the users of extensions. Words about a size parameter don't make sense at Python level.
The direct users of C API can read the PyUnicode_AsWideCharString()
documentation when they get this exception (as well as they can read the PyArg_ParseTuple()
documentation when they get the similar exception in PyArg_ParseTuple()
). It is explicitly documented.