Port to Python 3.11 * Replace "arg == Py_None" with Py_IsNone(arg) * Replace arg->ob_type with Py_TYPE(arg) * Replace "Py_TYPE(obj) = type" with Py_SET_TYPE(obj, type). * Copy pythoncapi_compat.h from: https://github.com/pythoncapi/pythoncapi_compat * pythoncapi_compat.h provides Py_SET_TYPE() and Py_IsNone() to old Python versions.
[PATCH] Use Py_ssize_t when parsing buffer length, fix #426 (#427) From python 3.9 documentation:
> For all # variants of formats (s#, y#, etc.), the macro > PY_SSIZE_T_CLEAN must be defined before including Python.h. On Python > 3.9 and older, the type of the length argument is Py_ssize_t if the > PY_SSIZE_T_CLEAN macro is defined, or int otherwise.
From python 3.8 changes:
> Use of # variants of formats in parsing or building value (e.g. > PyArg_ParseTuple(), Py_BuildValue(), PyObject_CallFunction(), etc.) > without PY_SSIZE_T_CLEAN defined raises DeprecationWarning now. It > will be removed in 3.10 or 4.0. Read Parsing arguments and building > values for detail. (Contributed by Inada Naoki in bpo-36381.)