From faf3214200437c07a14f2fdb2940695051f513dc Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 16 Aug 2020 15:02:02 -0400 Subject: [PATCH] Workaround incorrect __module__ https://github.com/sphinx-doc/sphinx/pull/8085 --- sphinx_autodoc_typehints.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx_autodoc_typehints.py b/sphinx_autodoc_typehints.py index e9e6ce5c..c4c00d3e 100644 --- a/sphinx_autodoc_typehints.py +++ b/sphinx_autodoc_typehints.py @@ -204,7 +204,7 @@ def get_all_type_hints(obj, name): try: rv = get_type_hints(obj) - except (AttributeError, TypeError, RecursionError): + except (AttributeError, TypeError, RecursionError, KeyError): # Introspecting a slot wrapper will raise TypeError, and and some recursive type # definitions will cause a RecursionError (https://github.com/python/typing/issues/574). pass @@ -225,7 +225,7 @@ def get_all_type_hints(obj, name): try: rv = get_type_hints(obj) - except (AttributeError, TypeError): + except (AttributeError, TypeError, KeyError): pass except NameError as exc: logger.warning('Cannot resolve forward reference in type annotations of "%s": %s',