diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-24 13:19:48 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-24 13:19:48 +0300 |
commit | 7ea7fd45d0fffed5cc67769a9fe050ae6a574554 (patch) | |
tree | 032b450cf6ee9d9a40c8f307305df1eff350266e /source/blender/python/bmesh | |
parent | f5456df095291c6cb2d0223a179746c8e514cd15 (diff) | |
parent | e03df90bf36f907a99ebd8cba6cf03cf05ca71a3 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/python/bmesh')
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index 8ab46240eed..629c3a3c7a3 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -3872,7 +3872,7 @@ void *BPy_BMElem_PySeq_As_Array_FAST( BMesh *bm = (r_bm && *r_bm) ? *r_bm : NULL; PyObject **seq_fast_items = PySequence_Fast_ITEMS(seq_fast); const Py_ssize_t seq_len = PySequence_Fast_GET_SIZE(seq_fast); - Py_ssize_t i; + Py_ssize_t i, i_last_dirty = PY_SSIZE_T_MAX; BPy_BMElem *item; BMElem **alloc; @@ -3921,6 +3921,7 @@ void *BPy_BMElem_PySeq_As_Array_FAST( if (do_unique_check) { BM_elem_flag_enable(item->ele, BM_ELEM_INTERNAL_TAG); + i_last_dirty = i; } } @@ -3937,6 +3938,8 @@ void *BPy_BMElem_PySeq_As_Array_FAST( } if (ok == false) { + /* Cleared above. */ + i_last_dirty = PY_SSIZE_T_MAX; PyErr_Format(PyExc_ValueError, "%s: found the same %.200s used multiple times", error_prefix, BPy_BMElem_StringFromHType(htype)); @@ -3949,6 +3952,11 @@ void *BPy_BMElem_PySeq_As_Array_FAST( return alloc; err_cleanup: + if (do_unique_check && (i_last_dirty != PY_SSIZE_T_MAX)) { + for (i = 0; i <= i_last_dirty; i++) { + BM_elem_flag_disable(alloc[i], BM_ELEM_INTERNAL_TAG); + } + } PyMem_FREE(alloc); return NULL; |