diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-06-09 18:16:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-06-09 18:16:50 +0300 |
commit | 89c978b14f72128defd484ec78ec0b8853233d7b (patch) | |
tree | 3cda86de3ac43ebb185576dc953717df33b08410 | |
parent | ade260aa7aaff50dd398c7511991ab9dcc98fc9d (diff) |
Use PySequence_Fast_ITEMS for direct access
-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 27707d9e95c..32cd0683339 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c @@ -361,9 +361,11 @@ static PyObject *bpy_bmlayeritem_from_array__clnors(BPy_BMLayerItem *self, PyObj return NULL; } + PyObject **value_items = PySequence_Fast_ITEMS(value); + vec_size = 3; /* In case value is an array of None's only. */ for (Py_ssize_t i = 0; i < nbr_val; i++) { - PyObject *py_vec = PySequence_Fast_GET_ITEM(value, i); + PyObject *py_vec = value_items[i]; if (py_vec == Py_None) { continue; @@ -389,7 +391,7 @@ static PyObject *bpy_bmlayeritem_from_array__clnors(BPy_BMLayerItem *self, PyObj if (vec_size == 2) { clnors = MEM_mallocN(sizeof(*clnors) * nbr_val, __func__); for (Py_ssize_t i = 0; i < nbr_val; i++) { - PyObject *py_vec = PySequence_Fast_GET_ITEM(value, i); + PyObject *py_vec = value_items[i]; if (py_vec == Py_None) { clnors[i][0] = clnors[i][1] = 0.0f; @@ -440,7 +442,7 @@ static PyObject *bpy_bmlayeritem_from_array__clnors(BPy_BMLayerItem *self, PyObj else { nors = MEM_mallocN(sizeof(*nors) * nbr_val, __func__); for (Py_ssize_t i = 0; i < nbr_val; i++) { - PyObject *py_vec = PySequence_Fast_GET_ITEM(value, i); + PyObject *py_vec = value_items[i]; if (py_vec == Py_None) { zero_v3(nors[i]); |