diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-06 08:42:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-01-06 11:09:11 +0300 |
commit | 9fd569a654ded46901c7f20c5fe080972cbb10d2 (patch) | |
tree | 933b893aeaa0a8bffe230933523512340dfa016d /source/blender/python/bmesh/bmesh_py_types_customdata.c | |
parent | ee58d449455df9470c4a0a902056b8c2001128bf (diff) |
PyAPI: add utilities PyTuple_SET_ITEMS, Py_INCREF_RET
Setting all values of a tuple is such a common operation that it deserves its own macro.
Also added Py_INCREF_RET to avoid confusing use of comma operator.
Diffstat (limited to 'source/blender/python/bmesh/bmesh_py_types_customdata.c')
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types_customdata.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c index 3c1502dc72b..bfcd91ac72d 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c @@ -42,6 +42,7 @@ #include "bmesh_py_types_meshdata.h" #include "../mathutils/mathutils.h" +#include "../generic/python_utildefines.h" #include "BKE_customdata.h" @@ -483,8 +484,9 @@ static PyObject *bpy_bmlayercollection_items(BPy_BMLayerCollection *self) for (i = 0; tot-- > 0; index++) { item = PyTuple_New(2); - PyTuple_SET_ITEM(item, 0, PyUnicode_FromString(data->layers[index].name)); - PyTuple_SET_ITEM(item, 1, BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index)); + PyTuple_SET_ITEMS(item, + PyUnicode_FromString(data->layers[index].name), + BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index)); PyList_SET_ITEM(ret, i++, item); } @@ -559,7 +561,7 @@ static PyObject *bpy_bmlayercollection_get(BPy_BMLayerCollection *self, PyObject } } - return Py_INCREF(def), def; + return Py_INCREF_RET(def); } static struct PyMethodDef bpy_bmlayeritem_methods[] = { |