diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-03-31 21:14:08 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-03-31 21:14:08 +0900 |
commit | 360efdefecfe7979dffe56905937592829eafa95 (patch) | |
tree | e3497b959d21842070fdfd5e0d07a9ca77823f7c | |
parent | ac2987a7d3434b8503cbe262c68dcb751b36fcfc (diff) | |
download | sphinx-git-360efdefecfe7979dffe56905937592829eafa95.tar.gz |
Fix #7355: autodoc: a signature of cython-function is not recognized well
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | sphinx/ext/autodoc/__init__.py | 1 | ||||
-rw-r--r-- | tests/roots/test-ext-autodoc/target/cython.pyx | 2 | ||||
-rw-r--r-- | tests/test_autodoc.py | 2 |
4 files changed, 4 insertions, 2 deletions
@@ -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 -------- diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index 7b6b3e4aa..041ebc20b 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -1019,6 +1019,7 @@ class FunctionDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # typ 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', diff --git a/tests/roots/test-ext-autodoc/target/cython.pyx b/tests/roots/test-ext-autodoc/target/cython.pyx index 1457db3c9..31ef33c29 100644 --- a/tests/roots/test-ext-autodoc/target/cython.pyx +++ b/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.""" diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index 741c4bb60..fc56a7f72 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -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.', |