Commit c36aa2f8 authored by Corentin Cadiou's avatar Corentin Cadiou Committed by GitHub

Allow default value for memory view (GH-4315)

Closes https://github.com/cython/cython/issues/4313
parent 9b25e0d6
......@@ -13192,6 +13192,9 @@ class CoercionNode(ExprNode):
code.annotate((file, line, col-1), AnnotationItem(
style='coerce', tag='coerce', text='[%s] to [%s]' % (self.arg.type, self.type)))
def analyse_types(self, env):
return self
class CoerceToMemViewSliceNode(CoercionNode):
"""
......
......@@ -308,6 +308,10 @@ cdef class C:
pass
cpdef f8(self, a, list s = [15]):
pass
cpdef f9(self, a, int[:] s = None):
pass
def f10(self, a, /, b=1, *, int[:] c=None):
pass
def check_defaults_on_methods_for_introspection():
......@@ -336,5 +340,12 @@ def check_defaults_on_methods_for_introspection():
>>> C.f8.__defaults__
([15],)
>>> C.f8.__kwdefaults__
>>> C.f9.__defaults__
(None,)
>>> C.f9.__kwdefaults__
>>> C.f10.__defaults__
(1,)
>>> C.f10.__kwdefaults__
{'c': None}
"""
pass
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment