diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-06-26 12:57:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-06-26 12:57:48 +0300 |
commit | 21f088018a653131793ce159a36938b1d98f75e4 (patch) | |
tree | 613cc2454f0133ca5c7bc860f61fa0bcaf665662 /source/blender/python | |
parent | 28b2f1c30504ce0e437b21f7964282fcd6894421 (diff) |
Used Py3.6 feature by accident, check version
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_manipulator_wrap.c | 15 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_manipulator.c | 24 |
2 files changed, 31 insertions, 8 deletions
diff --git a/source/blender/python/intern/bpy_manipulator_wrap.c b/source/blender/python/intern/bpy_manipulator_wrap.c index 53b6285e880..7d02c2963d7 100644 --- a/source/blender/python/intern/bpy_manipulator_wrap.c +++ b/source/blender/python/intern/bpy_manipulator_wrap.c @@ -58,8 +58,6 @@ static bool bpy_manipulatortype_target_property_def( { /* Note: names based on 'rna_rna.c' */ PyObject *empty_tuple = PyTuple_New(0); - static const char * const _keywords[] = {"id", "type", "array_length", NULL}; - static _PyArg_Parser _parser = {"|$ssi:register_class", _keywords, 0}; struct { char *id; @@ -72,15 +70,28 @@ static bool bpy_manipulatortype_target_property_def( .array_length = 1, }; + static const char * const _keywords[] = {"id", "type", "array_length", NULL}; +#define KW_FMT "|$ssi:register_class" +#if PY_VERSION_HEX >= 0x03060000 + static _PyArg_Parser _parser = {KW_FMT, _keywords, 0}; if (!_PyArg_ParseTupleAndKeywordsFast( empty_tuple, item, &_parser, ¶ms.id, ¶ms.type_id, ¶ms.array_length)) +#else + if (!PyArg_ParseTupleAndKeywords( + empty_tuple, item, + KW_FMT, (char **)_keywords, + ¶ms.id, + ¶ms.type_id, + ¶ms.array_length)) +#endif { goto fail; } +#undef KW_FMT if (params.id == NULL) { PyErr_SetString(PyExc_ValueError, "'id' argument not given"); diff --git a/source/blender/python/intern/bpy_rna_manipulator.c b/source/blender/python/intern/bpy_rna_manipulator.c index 245735f679e..d4f9a52db8d 100644 --- a/source/blender/python/intern/bpy_rna_manipulator.c +++ b/source/blender/python/intern/bpy_rna_manipulator.c @@ -238,12 +238,6 @@ PyDoc_STRVAR(bpy_manipulator_target_set_handler_doc, ); static PyObject *bpy_manipulator_target_set_handler(PyObject *UNUSED(self), PyObject *args, PyObject *kwds) { - /* Note: this is a counter-part to functions: - * 'Manipulator.target_set_prop & target_set_operator' - * (see: rna_wm_manipulator_api.c). conventions should match. */ - static const char * const _keywords[] = {"self", "target", "get", "set", "range", NULL}; - static _PyArg_Parser _parser = {"Os|$OOO:target_set_handler", _keywords, 0}; - PyGILState_STATE gilstate = PyGILState_Ensure(); struct { @@ -256,6 +250,13 @@ static PyObject *bpy_manipulator_target_set_handler(PyObject *UNUSED(self), PyOb .py_fn_slots = {NULL}, }; + /* Note: this is a counter-part to functions: + * 'Manipulator.target_set_prop & target_set_operator' + * (see: rna_wm_manipulator_api.c). conventions should match. */ + static const char * const _keywords[] = {"self", "target", "get", "set", "range", NULL}; +#define KW_FMT "Os|$OOO:target_set_handler" +#if PY_VERSION_HEX >= 0x03070000 + static _PyArg_Parser _parser = {KW_FMT, _keywords, 0}; if (!_PyArg_ParseTupleAndKeywordsFast( args, kwds, &_parser, @@ -264,9 +265,20 @@ static PyObject *bpy_manipulator_target_set_handler(PyObject *UNUSED(self), PyOb ¶ms.py_fn_slots[BPY_MANIPULATOR_FN_SLOT_GET], ¶ms.py_fn_slots[BPY_MANIPULATOR_FN_SLOT_SET], ¶ms.py_fn_slots[BPY_MANIPULATOR_FN_SLOT_RANGE_GET])) +#else + if (!PyArg_ParseTupleAndKeywords( + args, kwds, + KW_FMT, (char **)_keywords, + ¶ms.self, + ¶ms.target, + ¶ms.py_fn_slots[BPY_MANIPULATOR_FN_SLOT_GET], + ¶ms.py_fn_slots[BPY_MANIPULATOR_FN_SLOT_SET], + ¶ms.py_fn_slots[BPY_MANIPULATOR_FN_SLOT_RANGE_GET])) +#endif { goto fail; } +#undef KW_FMT wmManipulator *mpr = ((BPy_StructRNA *)params.self)->ptr.data; |