From 691ed21842397e52445fa8368fa81d757ba66123 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 22 Aug 2017 18:02:58 +1000 Subject: PyAPI: replace PyC_FromArray with typed functions This was meant to be generic but introduced possible type errors and unnecessary complication. Replace with typed PyC_Tuple_PackArray_* functions. Also add PyC_Tuple_Pack_* macro which replaces some uses of Py_BuildValue, with the advantage of not having to parse a string. --- source/blender/python/intern/bpy_app_sdl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source/blender/python/intern/bpy_app_sdl.c') diff --git a/source/blender/python/intern/bpy_app_sdl.c b/source/blender/python/intern/bpy_app_sdl.c index 76dab775953..816ad2833cc 100644 --- a/source/blender/python/intern/bpy_app_sdl.c +++ b/source/blender/python/intern/bpy_app_sdl.c @@ -29,6 +29,8 @@ #include "bpy_app_sdl.h" +#include "../generic/py_capi_utils.h" + #ifdef WITH_SDL /* SDL force defines __SSE__ and __SSE2__ flags, which generates warnings * because we pass those defines via command line as well. For until there's @@ -103,7 +105,7 @@ static PyObject *make_sdl_info(void) # endif # endif - SetObjItem(Py_BuildValue("(iii)", version.major, version.minor, version.patch)); + SetObjItem(PyC_Tuple_Pack_I32(version.major, version.minor, version.patch)); if (sdl_available) { SetObjItem(PyUnicode_FromFormat("%d.%d.%d", version.major, version.minor, version.patch)); } @@ -114,7 +116,7 @@ static PyObject *make_sdl_info(void) #else // WITH_SDL=OFF SetObjItem(PyBool_FromLong(0)); - SetObjItem(Py_BuildValue("(iii)", 0, 0, 0)); + SetObjItem(PyC_Tuple_Pack_I32(0, 0, 0)); SetStrItem("Unknown"); SetObjItem(PyBool_FromLong(0)); #endif -- cgit v1.2.3