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.
This commit is contained in:
2015-08-04 18:34:20 +10:00
parent 62c8f46ab6
commit cff288cf3a
9 changed files with 130 additions and 74 deletions

View File

@@ -116,11 +116,14 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args,
static const char *kwlist[] = {"mesh", "tessface", "destructive", NULL};
PyObject *py_me;
Mesh *me;
int do_tessface = true;
int is_destructive = true;
bool do_tessface = true;
bool is_destructive = true;
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:update_edit_mesh", (char **)kwlist,
&py_me, &do_tessface, &is_destructive))
if (!PyArg_ParseTupleAndKeywords(
args, kw, "O|O&O&:update_edit_mesh", (char **)kwlist,
&py_me,
PyC_ParseBool, &do_tessface,
PyC_ParseBool, &is_destructive))
{
return NULL;
}