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>2021-04-22 05:34:26 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-04-22 05:34:26 +0300
commit48c5129d1fcdaf53a281bf0359af85bd0185f038 (patch)
treed9e9abb5be399c99661aa3efbeaa0a95cd8e4a71
parent932b23782a5ec3e5cf739ff79e87dbc63353bcb1 (diff)
Fix errors in Buffer.dimensions `setter`
- Error accessing the length from a sequence. - Error comparing a boolean to -1. Issues introduced in 19360c2c1cf50c80b9720137b88db2c2f3626ddc
-rw-r--r--source/blender/python/gpu/gpu_py_buffer.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/source/blender/python/gpu/gpu_py_buffer.c b/source/blender/python/gpu/gpu_py_buffer.c
index 8ee11ff882c..e36e3b42617 100644
--- a/source/blender/python/gpu/gpu_py_buffer.c
+++ b/source/blender/python/gpu/gpu_py_buffer.c
@@ -81,7 +81,7 @@ static bool pygpu_buffer_pyobj_as_shape(PyObject *shape_obj,
}
}
else if (PySequence_Check(shape_obj)) {
- Py_ssize_t shape_len = PySequence_Size(shape_obj);
+ shape_len = PySequence_Size(shape_obj);
if (shape_len > MAX_DIMENSIONS) {
PyErr_SetString(PyExc_AttributeError,
"too many dimensions, max is " STRINGIFY(MAX_DIMENSIONS));
@@ -111,8 +111,6 @@ static bool pygpu_buffer_pyobj_as_shape(PyObject *shape_obj,
return false;
}
}
-
- *r_shape_len = shape_len;
}
else {
PyErr_Format(PyExc_TypeError,
@@ -398,7 +396,7 @@ static PyObject *pygpu_buffer__tp_new(PyTypeObject *UNUSED(type), PyObject *args
return NULL;
}
- if (pygpu_buffer_pyobj_as_shape(length_ob, shape, &shape_len) == -1) {
+ if (!pygpu_buffer_pyobj_as_shape(length_ob, shape, &shape_len)) {
return NULL;
}