Python 3.10: SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
Python 3.10 now requires extension modules to use the Py_ssize_t type rather than the int type for string lengths:
"* "The PY_SSIZE_T_CLEAN macro must now be defined to use PyArg_ParseTuple() and Py_BuildValue() formats which use #: es#, et#, s#, u#, y#, z#, U# and Z#. See Parsing arguments and building values and the PEP 353."
- https://docs.python.org/3.10/whatsnew/3.10.html#id2
- https://docs.python.org/3.10/c-api/arg.html#arg-parsing
- https://www.python.org/dev/peps/pep-0353
- https://bugs.python.org/issue40943
I wrote a 2 lines changes for python/generator.py to define the PY_SSIZE_T_CLEAN macro and uses the proper type.