diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-11-28 19:07:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-11-28 19:07:57 +0400 |
commit | 96136d3d888289bdde6101469e53bcdf391ee554 (patch) | |
tree | f9b3baa36bec3bf3987286b76c624eccd731d208 /source/blender/python/bmesh/bmesh_py_ops_call.c | |
parent | cac253a50236af8e8f427a2bf00d8dbdb1dee6e0 (diff) |
bmesh operator py api:
- fix for incorrect bmesh operator type-check for mapping slots.
- fix for python causing an assert when invalid args are given.
- fix memory leak with some exceptions.
Diffstat (limited to 'source/blender/python/bmesh/bmesh_py_ops_call.c')
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_ops_call.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c index c538daf9e51..ded35363287 100644 --- a/source/blender/python/bmesh/bmesh_py_ops_call.c +++ b/source/blender/python/bmesh/bmesh_py_ops_call.c @@ -584,8 +584,6 @@ static PyObject* bpy_slot_to_py(BMesh *bm, BMOpSlot *slot) PyObject *py_key = BPy_BMElem_CreatePyObject(bm, ele_key); PyObject *py_val = BPy_BMElem_CreatePyObject(bm, *(void **)BMO_OP_SLOT_MAPPING_DATA(ele_val)); - BLI_assert(slot->slot_subtype.elem & ((BPy_BMElem *)py_val)->ele->head.htype); - PyDict_SetItem(item, py_key, py_val); Py_DECREF(py_key); Py_DECREF(py_val); @@ -714,19 +712,23 @@ PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw) Py_ssize_t pos = 0; while (PyDict_Next(kw, &pos, &key, &value)) { const char *slot_name = _PyUnicode_AsString(key); - BMOpSlot *slot = BMO_slot_get(bmop.slots_in, slot_name); + BMOpSlot *slot; - if (slot == NULL) { + if (!BMO_slot_exists(bmop.slots_in, slot_name)) { PyErr_Format(PyExc_TypeError, "%.200s: keyword \"%.200s\" is invalid for this operator", self->opname, slot_name); + BMO_op_finish(bm, &bmop); return NULL; } + slot = BMO_slot_get(bmop.slots_in, slot_name); + /* now assign the value */ if (bpy_slot_from_py(bm, &bmop, slot, value, self->opname, slot_name) == -1) { + BMO_op_finish(bm, &bmop); return NULL; } } |