1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

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>
This commit is contained in:
Andrew Bartlett 2016-01-06 11:57:39 +13:00
parent 11de99a6d8
commit 46b8d7fc52

View File

@ -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: