Commit 05d0a375 authored by Jason Evans's avatar Jason Evans

Print default arguments syntactically, in order to (for example) preserve

quotes around strings.
parent 78881f8b
......@@ -21,7 +21,7 @@ class EmbedSignature(CythonTransform):
try:
denv = self.denv # XXX
ctval = arg.default.compile_time_value(self.denv)
return '%s' % ctval
return '%r' % ctval
except Exception:
try:
return arg.default.name # XXX
......
......@@ -36,6 +36,9 @@ __doc__ = ur"""
Ext.l(self, a, b, c=1, *args, d=42, e=17, f, **kwds)
Existing string
>>> print (Ext.m.__doc__)
Ext.m(self, a='spam')
>>> print (Ext.get_int.__doc__)
Ext.get_int(self) -> int
......@@ -64,6 +67,12 @@ __doc__ = ur"""
>>> with_doc_4.__doc__
'with_doc_4(int a, str b, list c) -> str\n\n Existing string\n '
>>> f_sd.__doc__
"f_sd(str s='spam')"
>>> cf_sd.__doc__
"cf_sd(str s='spam') -> str"
>>> types.__doc__
'types(Ext a, int b, unsigned short c, float d, e)'
......@@ -164,6 +173,9 @@ cdef class Ext:
"""Existing string"""
pass
def m(self, a='spam'):
pass
cpdef int get_int(self):
return 0
......@@ -203,6 +215,12 @@ cpdef str with_doc_4(int a, str b, list c):
"""
return b
def f_sd(str s='spam'):
return s
cpdef str cf_sd(str s='spam'):
return s
cpdef char f_c(char c):
return c
......
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