Python: define PY_SSIZE_T_CLEAN

It is recommended to always define PY_SSIZE_T_CLEAN before including
Python.h. Cf. https://docs.python.org/3/c-api/intro.html

This avoids errors like:

    SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
Heinrich Schuchardt 2022-05-09 19:53:20 +02:00
commit ca6a73277b
2 changed files with 6 additions and 1 deletions

View file

@ -29,7 +29,9 @@ As far as I know, this module is C++ safe.
#endif
%wrapper %{
#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif
#include <Python.h>
#ifdef __cplusplus