summaryrefslogtreecommitdiff
path: root/tests/errors/cpdef_vars.pyx
blob: b317d15b01037a92d4dcb1f1c8d008cbd378383e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# mode: error

cpdef str a = "123"
cpdef b = 2

cdef class C:
    cpdef float c

def func():
    """
    >>> c = func()
    >>> isinstance(c, C) or c
    True
    """
    cpdef d = C()
    return d


_ERRORS = """
3:6: Variables cannot be declared with 'cpdef'. Use 'cdef' instead.
4:6: Variables cannot be declared with 'cpdef'. Use 'cdef' instead.
7:10: Variables cannot be declared with 'cpdef'. Use 'cdef' instead.
15:10: Variables cannot be declared with 'cpdef'. Use 'cdef' instead.
"""