Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-02-04 06:39:06 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-02-04 06:39:06 +0300
commit4be95838947e0401fda2a67a867323718074ad86 (patch)
treeae03a59e7a8e4888a64ef6740b137c88084898ef /source/blender/python
parent36786c18d73af794320ff1f0b4d76b4b77ab90f4 (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')
-rw-r--r--source/blender/python/generic/mathutils.c5
-rw-r--r--source/blender/python/generic/mathutils_color.c2
-rw-r--r--source/blender/python/generic/mathutils_euler.c2
-rw-r--r--source/blender/python/generic/mathutils_matrix.c2
-rw-r--r--source/blender/python/generic/mathutils_quat.c2
-rw-r--r--source/blender/python/generic/mathutils_vector.c2
6 files changed, 8 insertions, 7 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;
}
diff --git a/source/blender/python/generic/mathutils_color.c b/source/blender/python/generic/mathutils_color.c
index 7a879cea3e0..3906f3e2b38 100644
--- a/source/blender/python/generic/mathutils_color.c
+++ b/source/blender/python/generic/mathutils_color.c
@@ -280,7 +280,7 @@ static PyObject *Color_subscript(ColorObject *self, PyObject *item)
return NULL;
if (slicelength <= 0) {
- return PyList_New(0);
+ return PyTuple_New(0);
}
else if (step == 1) {
return Color_slice(self, start, stop);
diff --git a/source/blender/python/generic/mathutils_euler.c b/source/blender/python/generic/mathutils_euler.c
index 10c8700148f..0294cfd72e9 100644
--- a/source/blender/python/generic/mathutils_euler.c
+++ b/source/blender/python/generic/mathutils_euler.c
@@ -446,7 +446,7 @@ static PyObject *Euler_subscript(EulerObject *self, PyObject *item)
return NULL;
if (slicelength <= 0) {
- return PyList_New(0);
+ return PyTuple_New(0);
}
else if (step == 1) {
return Euler_slice(self, start, stop);
diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c
index bd705791a9c..9d5dafbf6f8 100644
--- a/source/blender/python/generic/mathutils_matrix.c
+++ b/source/blender/python/generic/mathutils_matrix.c
@@ -1553,7 +1553,7 @@ static PyObject *Matrix_subscript(MatrixObject* self, PyObject* item)
return NULL;
if (slicelength <= 0) {
- return PyList_New(0);
+ return PyTuple_New(0);
}
else if (step == 1) {
return Matrix_slice(self, start, stop);
diff --git a/source/blender/python/generic/mathutils_quat.c b/source/blender/python/generic/mathutils_quat.c
index bc7d80bdfbb..1b571742cda 100644
--- a/source/blender/python/generic/mathutils_quat.c
+++ b/source/blender/python/generic/mathutils_quat.c
@@ -548,7 +548,7 @@ static PyObject *Quaternion_subscript(QuaternionObject *self, PyObject *item)
return NULL;
if (slicelength <= 0) {
- return PyList_New(0);
+ return PyTuple_New(0);
}
else if (step == 1) {
return Quaternion_slice(self, start, stop);
diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c
index 20bb0779af5..ba5cf4bb317 100644
--- a/source/blender/python/generic/mathutils_vector.c
+++ b/source/blender/python/generic/mathutils_vector.c
@@ -1324,7 +1324,7 @@ static PyObject *Vector_subscript(VectorObject* self, PyObject* item)
return NULL;
if (slicelength <= 0) {
- return PyList_New(0);
+ return PyTuple_New(0);
}
else if (step == 1) {
return Vector_slice(self, start, stop);