Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/sphinx_autodoc_typehints.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def format_annotation(annotation, fully_qualified=False):
if 'ForwardRef(' in str(bound):
try:
bound = bound._evaluate(sys.modules[annotation.__module__].__dict__, None)
except:
except Exception:
try:
bound = bound._evaluate(type_globals.__dict__, None)
except:
except Exception:
bound = bound.__forward_arg__
return format_annotation(bound, fully_qualified)
return f'\\{annotation!r}'
Expand Down Expand Up @@ -237,7 +237,7 @@ def get_all_type_hints(obj, name):
except NameError as exc:
try:
rv = get_type_hints(obj, localns=type_globals.__dict__)
except:
except Exception:
logger.warning('Cannot resolve forward reference in type annotations of "%s": %s',
name, exc)
rv = obj.__annotations__
Expand Down
Loading