From cff288cf3a0d71b610fa20875a321ea3b8db2388 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Aug 2015 18:34:20 +1000 Subject: Use PyC_ParseBool to parse bools This could cause problems since they could be any int, then passed directly to internal functions that assume bools. --- source/blender/python/intern/bpy_operator.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source/blender/python/intern/bpy_operator.c') diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index fc17173a5d4..7cccc204088 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -45,6 +45,7 @@ #include "bpy_rna.h" /* for setting arg props only - pyrna_py_to_prop() */ #include "bpy_util.h" #include "../generic/bpy_internal_import.h" +#include "../generic/py_capi_utils.h" #include "../generic/python_utildefines.h" #include "RNA_access.h" @@ -311,8 +312,8 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args) const char *opname; PyObject *kw = NULL; /* optional args */ - int all_args = 1; - int macro_args = 1; + bool all_args = true; + bool macro_args = true; int error_val = 0; char *buf = NULL; @@ -325,8 +326,14 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args) return NULL; } - if (!PyArg_ParseTuple(args, "s|O!ii:_bpy.ops.as_string", &opname, &PyDict_Type, &kw, &all_args, ¯o_args)) + if (!PyArg_ParseTuple( + args, "s|O!O&O&:_bpy.ops.as_string", + &opname, &PyDict_Type, &kw, + PyC_ParseBool, &all_args, + PyC_ParseBool, ¯o_args)) + { return NULL; + } ot = WM_operatortype_find(opname, true); -- cgit v1.2.3