1cdef class A:
2    @staticmethod
3    def static_def(int x):
4        """
5        >>> A.static_def(2)
6        ('def', 2)
7        >>> A().static_def(2)
8        ('def', 2)
9        """
10        return 'def', x
11
12    @staticmethod
13    cdef static_cdef(int* x):
14        return 'cdef', x[0]
15
16    @staticmethod
17    cdef static_cdef2(int* x, int* y):
18        return 'cdef2', x[0] + y[0]
19
20    @staticmethod
21    cdef static_cdef_untyped(a, b):
22        return 'cdef_utyped', a, b
23
24#     @staticmethod
25#     cpdef static_cpdef(int x):
26#         """
27#         >>> A.static_def
28#         >>> A.static_cpdef
29#
30#         >>> A().static_def
31#         >>> A().static_cpdef
32#
33#         >>> A.static_cpdef(2)
34#         ('cpdef', 2)
35#         >>> A().static_cpdef(2)
36#         ('cpdef', 2)
37#         """
38#         return 'cpdef', x
39
40def call_static_def(int x):
41    """
42    >>> call_static_def(2)
43    ('def', 2)
44    """
45    return A.static_def(x)
46
47def call_static_cdef(int x):
48    """
49    >>> call_static_cdef(2)
50    ('cdef', 2)
51    """
52    cdef int *x_ptr = &x
53    return A.static_cdef(x_ptr)
54
55def call_static_cdef2(int x, int y):
56    """
57    >>> call_static_cdef2(2, 3)
58    ('cdef2', 5)
59    """
60    return A.static_cdef2(&x, &y)
61
62def call_static_list_comprehension_GH1540(int x):
63    """
64    >>> call_static_list_comprehension_GH1540(5)
65    [('cdef', 5), ('cdef', 5), ('cdef', 5)]
66    """
67    return [A.static_cdef(&x) for _ in range(3)]
68
69# BROKEN
70#def call_static_cdef_untyped(a, b):
71#    """
72#    >>> call_static_cdef_untyped(100, None)
73#    ('cdef_untyped', 100, None)
74#    """
75#    return A.static_cdef_untyped(a, b)
76
77# UNIMPLEMENTED
78# def call_static_cpdef(int x):
79#     """
80#     >>> call_static_cpdef(2)
81#     ('cpdef', 2)
82#     """
83#     return A.static_cpdef(x)
84
85cdef class FromPxd:
86    @staticmethod
87    cdef static_cdef(int* x):
88        return 'pxd_cdef', x[0]
89
90def call_static_pxd_cdef(int x):
91    """
92    >>> call_static_pxd_cdef(2)
93    ('pxd_cdef', 2)
94    """
95    cdef int *x_ptr = &x
96    return FromPxd.static_cdef(x_ptr)
97