فهرست منبع

pgraph: Fix bug passing non-tuple sequence to shader input

rdb 4 سال پیش
والد
کامیت
f20d859fe2
2فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 1 1
      panda/src/pgraph/shaderInput_ext.cxx
  2. 5 0
      tests/pgraph/test_shaderinput.py

+ 1 - 1
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;

+ 5 - 0
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():