diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-08-04 11:34:20 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-08-04 11:49:42 +0300 |
commit | cff288cf3a0d71b610fa20875a321ea3b8db2388 (patch) | |
tree | 32d172a1953c6f5777690e616a8581fd8801be53 /source/blender/python/intern/bpy_operator.c | |
parent | 62c8f46ab6f16f99bcf848936a690e01f4c9e770 (diff) |
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.
Diffstat (limited to 'source/blender/python/intern/bpy_operator.c')
-rw-r--r-- | source/blender/python/intern/bpy_operator.c | 13 |
1 files changed, 10 insertions, 3 deletions
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); |