Skip to content

Commit

Permalink
inspect.getsource can raise TypeError (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmirabel authored Feb 11, 2022
1 parent 0807d00 commit a022d1a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sphinx_autodoc_typehints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def _resolve_type_guarded_imports(obj: Any) -> None:
if module:
try:
module_code = inspect.getsource(module)
except OSError:
except (TypeError, OSError):
... # no source code => no type guards
else:
for (_, part) in _TYPE_GUARD_IMPORT_RE.findall(module_code):
Expand Down

0 comments on commit a022d1a

Please sign in to comment.