@@ -34,10 +34,12 @@ def debug(Context context, Vector value):
3434@context_func
3535@ cython.boundscheck (False )
3636def sample (Context context , Vector texture_id , Vector coord , Vector default = null_):
37- cdef const float [:, :, :] data
38- if coord.numbers == NULL \
39- or (scene_node := context.references.get(texture_id.as_string())) is None \
40- or not hasattr (scene_node, ' array' ) or (data := scene_node.array) is None :
37+ cdef const float [:, :, :] data = None
38+ if coord.numbers != NULL \
39+ and (scene_node := context.references.get(texture_id.as_string())) is not None \
40+ and hasattr (scene_node, ' array' ):
41+ data = scene_node.array
42+ if data is None :
4143 return default
4244 cdef int64_t x, y, height= data.shape[0 ], width= data.shape[1 ]
4345 cdef const float [:] color
@@ -231,7 +233,7 @@ def split(Vector text, Vector separator=Vector('\n')):
231233def lenv (Vector xs not None ):
232234 cdef Vector ys = Vector.__new__ (Vector)
233235 ys.allocate_numbers(1 )
234- ys.numbers[0 ] = xs.length
236+ ys.numbers[0 ] = < double > ( xs.length)
235237 return ys
236238
237239
@@ -745,7 +747,7 @@ def minindex(Vector xs not None, *args):
745747 return null_
746748 ys = Vector.__new__ (Vector)
747749 ys.allocate_numbers(1 )
748- ys.numbers[0 ] = j
750+ ys.numbers[0 ] = < double > (j)
749751 return ys
750752
751753
@@ -813,7 +815,7 @@ def maxindex(Vector xs not None, *args):
813815 return null_
814816 ys = Vector.__new__ (Vector)
815817 ys.allocate_numbers(1 )
816- ys.numbers[0 ] = j
818+ ys.numbers[0 ] = < double > (j)
817819 return ys
818820
819821
0 commit comments