Fix : Iteration for BMLayerCollection was broken
It was broken in two ways: - bpy_bmlayercollection_iter passed PY_SSIZE_T_MIN, while PY_SSIZE_T_MAX was needed. - bpy_bmlayercollection_subscript_slice() contained an off-by-one error. Pull Request: blender/blender#107165
This commit is contained in:
@@ -785,11 +785,11 @@ static PyObject *bpy_bmlayercollection_subscript_slice(BPy_BMLayerCollection *se
|
||||
|
||||
BPY_BM_CHECK_OBJ(self);
|
||||
|
||||
if (start >= len) {
|
||||
start = len - 1;
|
||||
if (start > len) {
|
||||
start = len;
|
||||
}
|
||||
if (stop >= len) {
|
||||
stop = len - 1;
|
||||
if (stop > len) {
|
||||
stop = len;
|
||||
}
|
||||
|
||||
tuple = PyTuple_New(stop - start);
|
||||
@@ -915,7 +915,7 @@ static PyObject *bpy_bmlayercollection_iter(BPy_BMLayerCollection *self)
|
||||
|
||||
BPY_BM_CHECK_OBJ(self);
|
||||
|
||||
ret = bpy_bmlayercollection_subscript_slice(self, 0, PY_SSIZE_T_MIN);
|
||||
ret = bpy_bmlayercollection_subscript_slice(self, 0, PY_SSIZE_T_MAX);
|
||||
|
||||
if (ret) {
|
||||
iter = PyObject_GetIter(ret);
|
||||
|
||||
Reference in New Issue
Block a user