[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44036] trunk/blender/source: use ValueError when vector/matrix multiplications sizes are not supported, was using TypeError for mat*vec and ValueError for vec*mat.

Campbell Barton ideasman42 at gmail.com
Sat Feb 11 15:27:37 CET 2012


Revision: 44036
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44036
Author:   campbellbarton
Date:     2012-02-11 14:27:36 +0000 (Sat, 11 Feb 2012)
Log Message:
-----------
use ValueError when vector/matrix multiplications sizes are not supported, was using TypeError for mat*vec and ValueError for vec*mat.

Modified Paths:
--------------
    trunk/blender/source/blender/python/mathutils/mathutils_Vector.c
    trunk/blender/source/tests/bl_pyapi_mathutils.py

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Vector.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Vector.c	2012-02-11 13:19:25 UTC (rev 44035)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Vector.c	2012-02-11 14:27:36 UTC (rev 44036)
@@ -1497,7 +1497,7 @@
 			vec_cpy[3] = 1.0f;
 		}
 		else {
-			PyErr_SetString(PyExc_TypeError,
+			PyErr_SetString(PyExc_ValueError,
 			                "matrix * vector: "
 							"len(matrix.col) and len(vector) must be the same, "
 			                "except for 4x4 matrix * 3D vector.");

Modified: trunk/blender/source/tests/bl_pyapi_mathutils.py
===================================================================
--- trunk/blender/source/tests/bl_pyapi_mathutils.py	2012-02-11 13:19:25 UTC (rev 44035)
+++ trunk/blender/source/tests/bl_pyapi_mathutils.py	2012-02-11 14:27:36 UTC (rev 44036)
@@ -111,8 +111,8 @@
 
         vec = Vector((1, 2))
 
-        self.assertRaises(TypeError, mat1.__mul__, vec)
-        self.assertRaises(ValueError, vec.__mul__, mat1)  # Why are these different?!
+        self.assertRaises(ValueError, mat1.__mul__, vec)
+        self.assertRaises(ValueError, vec.__mul__, mat1)
 
         mat2 = Matrix(((1, 2),
                        (-2, 3)))




More information about the Bf-blender-cvs mailing list