Skip to content

Commit

Permalink
Merge pull request #7403 from tk0miya/7355_wrong_signature_cython
Browse files Browse the repository at this point in the history
Fix #7355: autodoc: a signature of cython-function is not recognized well
  • Loading branch information
tk0miya committed Mar 31, 2020
2 parents ac2987a + 360efde commit 1d299d3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -31,6 +31,7 @@ Bugs fixed
* #7301: capital characters are not allowed for node_id
* #7301: epub: duplicated node_ids are generated
* #6564: html: a width of table was ignored on HTML builder
* #7355: autodoc: a signature of cython-function is not recognized well

Testing
--------
Expand Down
1 change: 1 addition & 0 deletions sphinx/ext/autodoc/__init__.py
Expand Up @@ -1019,6 +1019,7 @@ def format_args(self, **kwargs: Any) -> str:
if (not inspect.isfunction(self.object) and
not inspect.ismethod(self.object) and
not inspect.isbuiltin(self.object) and
not inspect.is_cython_function_or_method(self.object) and
not inspect.isclass(self.object) and
hasattr(self.object, '__call__')):
self.env.app.emit('autodoc-before-process-signature',
Expand Down
2 changes: 1 addition & 1 deletion tests/roots/test-ext-autodoc/target/cython.pyx
@@ -1,6 +1,6 @@
# cython: binding=True

def foo(*args, **kwargs):
def foo(x: int, *args, y: str, **kwargs):
"""Docstring."""


Expand Down
2 changes: 1 addition & 1 deletion tests/test_autodoc.py
Expand Up @@ -1641,7 +1641,7 @@ def test_cython():
' Docstring.',
'',
'',
'.. py:function:: foo(*args, **kwargs)',
'.. py:function:: foo(x: int, *args, y: str, **kwargs)',
' :module: target.cython',
'',
' Docstring.',
Expand Down

0 comments on commit 1d299d3

Please sign in to comment.