I had to patch Python3 to suppress the error.
diff --git a/Python/getargs.c b/Python/getargs.c index 066739f..e85b116 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -426,6 +426,7 @@ vgetargs1(PyObject *args, const char *format, va_list *p_va, int flags) stack = _PyTuple_ITEMS(args); nargs = PyTuple_GET_SIZE(args); + flags = FLAG_SIZE_T; } else { stack = NULL;
Problem:
The flags variable remains 0 in the whole function call chain unconditional (getsargs.c file).
PyArg_ParseTuple() (defined as 0)- > vgetargs1() -> vgetargs1_impl() - convertitem() -> convertsimple().
The only change in value is:
flags = flags & ~FLAG_COMPAT;
But that doesn't changes the value if flags is 0.
And finally always ends up in the error, defined as macro in convertsimple().
#define REQUIRE_PY_SSIZE_T_CLEAN \ if (!(flags & FLAG_SIZE_T)) { \ PyErr_SetString(PyExc_SystemError, \ "PY_SSIZE_T_CLEAN macro must be defined for '#' formats"); \ RETURN_ERR_OCCURRED; \ }
Or I overlooked something?