File: e_arrayassign.pyx

package info (click to toggle)
cython 3.0.11%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 19,092 kB
  • sloc: python: 83,539; ansic: 18,831; cpp: 1,402; xml: 1,031; javascript: 511; makefile: 403; sh: 204; sed: 11
file content (36 lines) | stat: -rw-r--r-- 596 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# mode: error
# cython: auto_pickle=False

ctypedef int[1] int_array
ctypedef int[2] int_array2


cdef int_array x, y
x = y  # not an error

cdef int_array *x_ptr = &x
x_ptr[0] = y  # not an error

cdef class A:
    cdef int_array value
    def __init__(self):
        self.value = x  # not an error


cdef int_array2 z
z = x  # error
x = z  # error

cdef enum:
    SIZE = 2

ctypedef int[SIZE] int_array_dyn

cdef int_array_dyn d
d = z  # not an error


_ERRORS = u"""
21:0: Assignment to slice of wrong length, expected 2, got 1
22:0: Assignment to slice of wrong length, expected 1, got 2
"""