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

@@ -1951,7 +1951,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
"options", "subtype", "update", "get", "set", NULL};
const char *id = NULL, *name = NULL, *description = "";
int id_len;
int def = 0;
bool def = false;
PropertyRNA *prop;
PyObject *pyopts = NULL;
int opts = 0;
@@ -1962,9 +1962,9 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
PyObject *set_cb = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kw,
"s#|ssiO!sOOO:BoolProperty",
"s#|ssO&O!sOOO:BoolProperty",
(char **)kwlist, &id, &id_len,
&name, &description, &def,
&name, &description, PyC_ParseBool, &def,
&PySet_Type, &pyopts, &pysubtype,
&update_cb, &get_cb, &set_cb))
{