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:
authormano-wii <germano.costa@ig.com.br>2018-10-04 19:48:08 +0300
committermano-wii <germano.costa@ig.com.br>2018-10-04 19:49:06 +0300
commitb183f57a9e73a4bdd5b232d2604f84fd21efc17b (patch)
tree043a62fa2ed15c6447c98c954c8ae038bd5b969c /source/blender/python
parent9d8c05f7ecf6c20d48c3b151653bab5cc1b988aa (diff)
GPU Python: Fix assert in PySequence_Fast_GET_SIZE
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/gpu/gpu_py_shader.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/python/gpu/gpu_py_shader.c b/source/blender/python/gpu/gpu_py_shader.c
index 5aa467f1dfc..135e9c31c3f 100644
--- a/source/blender/python/gpu/gpu_py_shader.c
+++ b/source/blender/python/gpu/gpu_py_shader.c
@@ -369,10 +369,13 @@ static PyObject *bpygpu_shader_uniform_bool(
{
PyObject *seq_fast = PySequence_Fast(params.seq, error_prefix);
if (seq_fast == NULL) {
+ PyErr_Format(PyExc_TypeError,
+ "%s: expected a sequence, got %s",
+ error_prefix, Py_TYPE(params.seq)->tp_name);
ret = -1;
}
else {
- length = PySequence_Fast_GET_SIZE(params.seq);
+ length = PySequence_Fast_GET_SIZE(seq_fast);
if (length == 0 || length > 4) {
PyErr_Format(PyExc_TypeError,
"%s: invalid sequence length. expected 1..4, got %d",
@@ -434,10 +437,13 @@ static PyObject *bpygpu_shader_uniform_float(
{
PyObject *seq_fast = PySequence_Fast(params.seq, error_prefix);
if (seq_fast == NULL) {
+ PyErr_Format(PyExc_TypeError,
+ "%s: expected a sequence, got %s",
+ error_prefix, Py_TYPE(params.seq)->tp_name);
ret = -1;
}
else {
- length = PySequence_Fast_GET_SIZE(params.seq);
+ length = PySequence_Fast_GET_SIZE(seq_fast);
if ((length == 0) || (length > 16) ||
(4 < length && length < 9) ||
(9 < length && length < 16))
@@ -502,10 +508,13 @@ static PyObject *bpygpu_shader_uniform_int(
{
PyObject *seq_fast = PySequence_Fast(params.seq, error_prefix);
if (seq_fast == NULL) {
+ PyErr_Format(PyExc_TypeError,
+ "%s: expected a sequence, got %s",
+ error_prefix, Py_TYPE(params.seq)->tp_name);
ret = -1;
}
else {
- length = PySequence_Fast_GET_SIZE(params.seq);
+ length = PySequence_Fast_GET_SIZE(seq_fast);
if (length == 0 || length > 4) {
PyErr_Format(PyExc_TypeError,
"%s: invalid sequence length. expected 1..4, got %d",