forked from bartvdbraak/blender
fix for very bad bug with python list slicing which - in bmesh and bpy api for all? 2.5x + releases.
negative stop values when slicing was broken. eg. bpy.data.objects[0:-2] != list(bpy.data.objects)[0:-2]
This commit is contained in:
parent
d08abbee69
commit
95002a98bf
@ -2581,7 +2581,7 @@ static PyObject *bpy_bmelemseq_subscript(BPy_BMElemSeq *self, PyObject *key)
|
||||
/* only get the length for negative values */
|
||||
Py_ssize_t len = bpy_bmelemseq_length(self);
|
||||
if (start < 0) start += len;
|
||||
if (stop < 0) start += len;
|
||||
if (stop < 0) stop += len;
|
||||
}
|
||||
|
||||
if (stop - start <= 0) {
|
||||
|
@ -685,7 +685,7 @@ static PyObject *bpy_bmlayercollection_subscript(BPy_BMLayerCollection *self, Py
|
||||
/* only get the length for negative values */
|
||||
Py_ssize_t len = bpy_bmlayercollection_length(self);
|
||||
if (start < 0) start += len;
|
||||
if (stop < 0) start += len;
|
||||
if (stop < 0) stop += len;
|
||||
}
|
||||
|
||||
if (stop - start <= 0) {
|
||||
|
@ -280,7 +280,7 @@ static PyObject *bpy_bmeditselseq_subscript(BPy_BMEditSelSeq *self, PyObject *ke
|
||||
/* only get the length for negative values */
|
||||
Py_ssize_t len = bpy_bmeditselseq_length(self);
|
||||
if (start < 0) start += len;
|
||||
if (stop < 0) start += len;
|
||||
if (stop < 0) stop += len;
|
||||
}
|
||||
|
||||
if (stop - start <= 0) {
|
||||
|
@ -2420,7 +2420,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
|
||||
/* only get the length for negative values */
|
||||
Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop);
|
||||
if (start < 0) start += len;
|
||||
if (stop < 0) start += len;
|
||||
if (stop < 0) stop += len;
|
||||
}
|
||||
|
||||
if (stop - start <= 0) {
|
||||
@ -2546,7 +2546,7 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *
|
||||
/* only get the length for negative values */
|
||||
Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop);
|
||||
if (start < 0) start += len;
|
||||
if (stop < 0) start += len;
|
||||
if (stop < 0) stop += len;
|
||||
}
|
||||
|
||||
if (stop - start <= 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user