Merge pull request #7141 from tk0miya/7318_typehints_crashed_by_unboundobj

Fix #7138: autodoc: crashed when variable has unbound object
This commit is contained in:
Takeshi KOMIYA 2020-02-14 01:03:08 +09:00 committed by GitHub
commit 67abd960ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -16,6 +16,9 @@ Features added
Bugs fixed
----------
* #7138: autodoc: ``autodoc.typehints`` crashed when variable has unbound object
as a value
Testing
--------

View File

@ -46,7 +46,7 @@ def record_typehints(app: Sphinx, objtype: str, name: str, obj: Any,
annotation[param.name] = typing.stringify(param.annotation)
if sig.return_annotation is not sig.empty:
annotation['return'] = typing.stringify(sig.return_annotation)
except TypeError:
except (TypeError, ValueError):
pass