[Bf-blender-cvs] [b183f57a9e7] blender2.8: GPU Python: Fix assert in PySequence_Fast_GET_SIZE

mano-wii noreply at git.blender.org
Thu Oct 4 18:51:34 CEST 2018


Commit: b183f57a9e73a4bdd5b232d2604f84fd21efc17b
Author: mano-wii
Date:   Thu Oct 4 13:48:08 2018 -0300
Branches: blender2.8
https://developer.blender.org/rBb183f57a9e73a4bdd5b232d2604f84fd21efc17b

GPU Python: Fix assert in PySequence_Fast_GET_SIZE

===================================================================

M	source/blender/python/gpu/gpu_py_shader.c

===================================================================

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",



More information about the Bf-blender-cvs mailing list