diff options
author | Andrew Bartlett <abartlet@samba.org> | 2016-01-06 11:57:39 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2016-01-07 23:33:10 +0100 |
commit | 46b8d7fc522f2fa084b56451ce3775e7138e2bca (patch) | |
tree | 2a7af7214307c067d1f39f03edcc49fe9137a912 /buildtools | |
parent | 11de99a6d83c0ec34481847d2adff9a99f41385d (diff) | |
download | samba-46b8d7fc522f2fa084b56451ce3775e7138e2bca.tar.gz |
python: Assert that we use Py_ssize_t consistently for PyParseArgs*()
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Diffstat (limited to 'buildtools')
-rw-r--r-- | buildtools/wafsamba/samba_python.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py index 80753812d83..8ce1b43b61c 100644 --- a/buildtools/wafsamba/samba_python.py +++ b/buildtools/wafsamba/samba_python.py @@ -99,6 +99,17 @@ def SAMBA_PYTHON(bld, name, if init_function_sentinel is not None: cflags += '-DSTATIC_LIBPYTHON_MODULES=%s' % init_function_sentinel + # From https://docs.python.org/2/c-api/arg.html: + # Starting with Python 2.5 the type of the length argument to + # PyArg_ParseTuple(), PyArg_ParseTupleAndKeywords() and PyArg_Parse() + # can be controlled by defining the macro PY_SSIZE_T_CLEAN before + # including Python.h. If the macro is defined, length is a Py_ssize_t + # rather than an int. + + # Because <Python.h> if often included before includes.h/config.h + # This must be in the -D compiler options + cflags += ' -DPY_SSIZE_T_CLEAN=1' + source = bld.EXPAND_VARIABLES(source, vars=vars) if realname is not None: |