diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-10-16 11:36:01 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-10-16 11:36:01 +0300 |
commit | c2fbe46b0f0fde44b8a40d89601a195da27d28fb (patch) | |
tree | f66e3e50758acb36001e2774c6e4ede5fc8bead6 /source/blender/python/generic/py_capi_utils.c | |
parent | 386ba094988fc793f8e060d15438566e5e2d2cae (diff) | |
parent | dcf57e34f3866bba5ddd9cfdfe858a1a5eedc4c2 (diff) |
Merge branch 'master' into temp-gpencil-drw-enginetemp-gpencil-drw-engine
Diffstat (limited to 'source/blender/python/generic/py_capi_utils.c')
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index a6983c38f0e..c85a1d9ba05 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -25,9 +25,18 @@ * BLI_string_utf8() for unicode conversion. */ +/* Future-proof, See https://docs.python.org/3/c-api/arg.html#strings-and-buffers */ +#define PY_SSIZE_T_CLEAN + #include <Python.h> #include <frameobject.h> +/* Needed for 'PyInterpreterState', we should remove this dependency. */ +#if PY_VERSION_HEX >= 0x03080000 +# define Py_BUILD_CORE +# include <internal/pycore_pystate.h> +#endif + #include "BLI_utildefines.h" /* for bool */ #include "py_capi_utils.h" @@ -867,7 +876,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...) va_list vargs; - int *sizes = PyMem_MALLOC(sizeof(int) * (n / 2)); + Py_ssize_t *sizes = PyMem_MALLOC(sizeof(*sizes) * (n / 2)); int i; PyObject *py_dict = PyC_DefaultNameSpace(filepath); |