Fix #7629: autodoc: autofunction emits an unfriendly warning

This commit is contained in:
Takeshi KOMIYA 2020-05-09 22:25:30 +09:00
parent 63457c700c
commit 182712fe31
2 changed files with 7 additions and 1 deletions

View File

@ -90,6 +90,8 @@ Bugs fixed
* #7362: autodoc: does not render correct signatures for built-in functions
* #7654: autodoc: ``Optional[Union[foo, bar]]`` is presented as
``Union[foo, bar, None]``
* #7629: autodoc: autofunction emits an unfriendly warning if an invalid object
specified
* #7551: autosummary: a nested class is indexed as non-nested class
* #7535: sphinx-autogen: crashes when custom template uses inheritance
* #7536: sphinx-autogen: crashes when template uses i18n feature

View File

@ -1056,7 +1056,11 @@ class FunctionDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # typ
self.env.app.emit('autodoc-before-process-signature', unwrapped, False)
sig = inspect.signature(unwrapped)
args = stringify_signature(sig, **kwargs)
except TypeError:
except TypeError as exc:
logger.warning(__("Failed to get a function signature for %s: %s"),
self.fullname, exc)
return None
except ValueError:
args = ''
if self.env.config.strip_signature_backslash: