diff options
Diffstat (limited to 'sphinx/ext/autodoc/inspector.py')
-rw-r--r-- | sphinx/ext/autodoc/inspector.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sphinx/ext/autodoc/inspector.py b/sphinx/ext/autodoc/inspector.py index 6e07c9547..be42237c6 100644 --- a/sphinx/ext/autodoc/inspector.py +++ b/sphinx/ext/autodoc/inspector.py @@ -130,8 +130,11 @@ def formatargspec(function, args, varargs=None, varkw=None, defaults=None, else: return value - introspected_hints = (typing.get_type_hints(function) # type: ignore - if typing and hasattr(function, '__code__') else {}) + try: + introspected_hints = (typing.get_type_hints(function) # type: ignore + if typing and hasattr(function, '__code__') else {}) + except Exception: + introspected_hints = {} fd = StringIO() fd.write('(') |