Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
f8920f1f
Commit
f8920f1f
authored
Oct 10, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show argument types in docstring of wrapped C function
parent
cba125d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+1
-0
Cython/Utility/CFuncConvert.pyx
Cython/Utility/CFuncConvert.pyx
+1
-1
tests/run/cfunc_convert.pyx
tests/run/cfunc_convert.pyx
+11
-1
No files found.
Cython/Compiler/PyrexTypes.py
View file @
f8920f1f
...
...
@@ -2669,6 +2669,7 @@ class CFuncType(CType):
self
.
type
=
arg
.
type
self
.
type_name
=
'TYPE%s'
%
ix
self
.
type_cname
=
self
.
type
.
declaration_code
(
""
)
self
.
type_displayname
=
self
.
type
.
declaration_code
(
""
,
for_display
=
True
)
if
self
.
type
.
is_extension_type
or
self
.
type
.
is_builtin_type
:
self
.
type_convert
=
'<%s>'
%
self
.
type_name
elif
self
.
type
.
is_pyobject
:
...
...
Cython/Utility/CFuncConvert.pyx
View file @
f8920f1f
...
...
@@ -14,7 +14,7 @@ cdef extern from *:
@
cname
(
"{{cname}}"
)
cdef
object
{{
cname
}}({{
return_type
}}
(
*
f
)({{
', '
.
join
(
arg
.
type_name
for
arg
in
args
)
}})
{{
except_clause
}}):
def
wrap
({{
', '
.
join
(
arg
.
name
for
arg
in
args
)
}}):
"""wrap({{', '.join(
arg.name
for arg in args)}})"""
"""wrap({{', '.join(
'{arg.name}: {arg.type_displayname!r}'.format(arg=arg)
for arg in args)}})"""
{{
for
arg
in
args
}}
{{
arg
.
check_type
()}}
{{
endfor
}}
...
...
tests/run/cfunc_convert.pyx
View file @
f8920f1f
...
...
@@ -38,7 +38,7 @@ def return_square_c():
>>> square_c(x=4)
16.0
>>> square_c.__doc__ # FIXME: try to make original C function name available
'wrap(x)'
"wrap(x: 'double')"
"""
return
square_c
...
...
@@ -88,6 +88,16 @@ def call_abc(a, b, c):
cdef
object
py_func
=
abc
return
py_func
(
a
,
b
,
c
)
def
return_abc
():
"""
>>> abc = return_abc()
>>> abc(2, 3, 5)
False
>>> abc.__doc__
"wrap(a: 'long long', b: 'long long', c: 'long long')"
"""
return
abc
ctypedef
double
foo
cdef
foo
test_typedef_cfunc
(
foo
x
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment