Closed tp-sy closed 2 years ago
CPython code in pysapcompress.cpp needed some changes to be compatible with python 3.10.
Python 3.10 now requires the PY_SSIZE_T_CLEAN macro to be defined when using PyArg_ParseTuple() with "s#" format, which makes it always return a Py_ssize_t type instead of int. (see: https://docs.python.org/3/whatsnew/3.10.html#id2 and https://peps.python.org/pep-0353/). If the macro isn't defined the program crashes with
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
Checking the size of the length arguments and then converting them to int type is enough to fix the issue.
Got it working on both Python 3.8 as well as Python 3.10. Thanks @tp-sy!
CPython code in pysapcompress.cpp needed some changes to be compatible with python 3.10.
Python 3.10 now requires the PY_SSIZE_T_CLEAN macro to be defined when using PyArg_ParseTuple() with "s#" format, which makes it always return a Py_ssize_t type instead of int. (see: https://docs.python.org/3/whatsnew/3.10.html#id2 and https://peps.python.org/pep-0353/). If the macro isn't defined the program crashes with
Checking the size of the length arguments and then converting them to int type is enough to fix the issue.