Commit 9139a7f8 authored by Stefan Behnel's avatar Stefan Behnel

support NULL as default argument in auto doc transform

parent 8a8c8d27
...@@ -51,6 +51,8 @@ class EmbedSignature(CythonTransform): ...@@ -51,6 +51,8 @@ class EmbedSignature(CythonTransform):
default_val = arg.default default_val = arg.default
if not default_val: if not default_val:
return None return None
if isinstance(default_val, ExprNodes.NullNode):
return 'NULL'
try: try:
denv = self.denv # XXX denv = self.denv # XXX
ctval = default_val.compile_time_value(self.denv) ctval = default_val.compile_time_value(self.denv)
......
...@@ -199,6 +199,9 @@ __doc__ = ur""" ...@@ -199,6 +199,9 @@ __doc__ = ur"""
>>> print(funcdoc(f_defexpr5)) >>> print(funcdoc(f_defexpr5))
f_defexpr5(int x=4) f_defexpr5(int x=4)
>>> print(funcdoc(f_charptr_null))
f_charptr_null(char *s=NULL) -> char *
""" """
cdef class Ext: cdef class Ext:
...@@ -403,6 +406,10 @@ cpdef f_defexpr4(int x = (Ext.CONST1 + FLAG1) * Ext.CONST2): ...@@ -403,6 +406,10 @@ cpdef f_defexpr4(int x = (Ext.CONST1 + FLAG1) * Ext.CONST2):
cpdef f_defexpr5(int x = 2+2): cpdef f_defexpr5(int x = 2+2):
pass pass
cpdef (char*) f_charptr_null(char* s=NULL):
return s or b'abc'
# no signatures for lambda functions # no signatures for lambda functions
lambda_foo = lambda x: 10 lambda_foo = lambda x: 10
lambda_bar = lambda x: 20 lambda_bar = lambda x: 20
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