diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-04 06:39:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-04 06:39:06 +0300 |
commit | 4be95838947e0401fda2a67a867323718074ad86 (patch) | |
tree | ae03a59e7a8e4888a64ef6740b137c88084898ef /source/blender/python/generic/mathutils.c | |
parent | 36786c18d73af794320ff1f0b4d76b4b77ab90f4 (diff) |
small mathutils changes.
- fix for returning empty slices (was returning list rather then tuple).
- report invalid type when mathutils_array_parse_fast() fails.
Diffstat (limited to 'source/blender/python/generic/mathutils.c')
-rw-r--r-- | source/blender/python/generic/mathutils.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c index 854aa4f625e..29b64dad1e3 100644 --- a/source/blender/python/generic/mathutils.c +++ b/source/blender/python/generic/mathutils.c @@ -85,6 +85,7 @@ static char M_Mathutils_doc[] = static int mathutils_array_parse_fast(float *array, int array_min, int array_max, PyObject *value, const char *error_prefix) { PyObject *value_fast= NULL; + PyObject *item; int i, size; @@ -106,8 +107,8 @@ static int mathutils_array_parse_fast(float *array, int array_min, int array_max i= size; do { i--; - if(((array[i]= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i))) == -1.0) && PyErr_Occurred()) { - PyErr_Format(PyExc_ValueError, "%.200s: sequence index %d is not a float", error_prefix, i); + if(((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0) && PyErr_Occurred()) { + PyErr_Format(PyExc_ValueError, "%.200s: sequence index %d expected a number, found '%.200s' type, ", error_prefix, i, Py_TYPE(item)->tp_name); Py_DECREF(value_fast); return -1; } |