[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48312] trunk/blender/source/blender/ python/mathutils/mathutils_Vector.c: mathutils.Vector(kw=value) wasn' t raising an error as it should.

Campbell Barton ideasman42 at gmail.com
Tue Jun 26 16:49:56 CEST 2012


Revision: 48312
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48312
Author:   campbellbarton
Date:     2012-06-26 14:49:49 +0000 (Tue, 26 Jun 2012)
Log Message:
-----------
mathutils.Vector(kw=value) wasn't raising an error as it should.

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

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Vector.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Vector.c	2012-06-26 13:53:00 UTC (rev 48311)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Vector.c	2012-06-26 14:49:49 UTC (rev 48312)
@@ -54,11 +54,18 @@
 /* Supports 2D, 3D, and 4D vector objects both int and float values
  * accepted. Mixed float and int values accepted. Ints are parsed to float
  */
-static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds))
+static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
 	float *vec = NULL;
 	int size = 3; /* default to a 3D vector */
 
+	if (kwds && PyDict_Size(kwds)) {
+		PyErr_SetString(PyExc_TypeError,
+		                "Vector(): "
+		                "takes no keyword args");
+		return NULL;
+	}
+
 	switch (PyTuple_GET_SIZE(args)) {
 		case 0:
 			vec = PyMem_Malloc(size * sizeof(float));




More information about the Bf-blender-cvs mailing list