[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50896] trunk/blender/source/blender/ python: fix for very bad bug with python list slicing which - in bmesh and bpy api for all ? 2.5x + releases.

Campbell Barton ideasman42 at gmail.com
Wed Sep 26 01:41:33 CEST 2012


Revision: 50896
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50896
Author:   campbellbarton
Date:     2012-09-25 23:41:32 +0000 (Tue, 25 Sep 2012)
Log Message:
-----------
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]

Modified Paths:
--------------
    trunk/blender/source/blender/python/bmesh/bmesh_py_types.c
    trunk/blender/source/blender/python/bmesh/bmesh_py_types_customdata.c
    trunk/blender/source/blender/python/bmesh/bmesh_py_types_select.c
    trunk/blender/source/blender/python/intern/bpy_rna.c

Modified: trunk/blender/source/blender/python/bmesh/bmesh_py_types.c
===================================================================
--- trunk/blender/source/blender/python/bmesh/bmesh_py_types.c	2012-09-25 23:28:15 UTC (rev 50895)
+++ trunk/blender/source/blender/python/bmesh/bmesh_py_types.c	2012-09-25 23:41:32 UTC (rev 50896)
@@ -2581,7 +2581,7 @@
 				/* 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) {

Modified: trunk/blender/source/blender/python/bmesh/bmesh_py_types_customdata.c
===================================================================
--- trunk/blender/source/blender/python/bmesh/bmesh_py_types_customdata.c	2012-09-25 23:28:15 UTC (rev 50895)
+++ trunk/blender/source/blender/python/bmesh/bmesh_py_types_customdata.c	2012-09-25 23:41:32 UTC (rev 50896)
@@ -685,7 +685,7 @@
 				/* 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) {

Modified: trunk/blender/source/blender/python/bmesh/bmesh_py_types_select.c
===================================================================
--- trunk/blender/source/blender/python/bmesh/bmesh_py_types_select.c	2012-09-25 23:28:15 UTC (rev 50895)
+++ trunk/blender/source/blender/python/bmesh/bmesh_py_types_select.c	2012-09-25 23:41:32 UTC (rev 50896)
@@ -280,7 +280,7 @@
 				/* 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) {

Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c	2012-09-25 23:28:15 UTC (rev 50895)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c	2012-09-25 23:41:32 UTC (rev 50896)
@@ -2420,7 +2420,7 @@
 				/* 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 @@
 				/* 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) {




More information about the Bf-blender-cvs mailing list