From f20d859fe248d777b78739a81083993ee222ba11 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 16 Jan 2021 14:05:43 +0100 Subject: [PATCH] pgraph: Fix bug passing non-tuple sequence to shader input --- panda/src/pgraph/shaderInput_ext.cxx | 2 +- tests/pgraph/test_shaderinput.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/panda/src/pgraph/shaderInput_ext.cxx b/panda/src/pgraph/shaderInput_ext.cxx index 72a4d74de3..62b66777cc 100644 --- a/panda/src/pgraph/shaderInput_ext.cxx +++ b/panda/src/pgraph/shaderInput_ext.cxx @@ -282,7 +282,7 @@ __init__(CPT_InternalName name, PyObject *value, int priority) { return; } - Py_ssize_t num_items = PySequence_Fast_GET_SIZE(value); + Py_ssize_t num_items = PySequence_Fast_GET_SIZE(fast); if (num_items <= 0) { // We can't determine the type of a list of size 0. _this->_type = ShaderInput::M_numeric; diff --git a/tests/pgraph/test_shaderinput.py b/tests/pgraph/test_shaderinput.py index 68bb6b2e24..2792148dd0 100644 --- a/tests/pgraph/test_shaderinput.py +++ b/tests/pgraph/test_shaderinput.py @@ -1,4 +1,9 @@ from panda3d.core import ShaderInput, Vec4 +from array import array + + +def test_shaderinput_construct_sequence_int(): + i = ShaderInput('test', array('I', [1, 2, 3, 4])) def test_shaderinput_vector_compare():