Skip to content

Commit a022d1a

Browse files
authored
inspect.getsource can raise TypeError (#210)
1 parent 0807d00 commit a022d1a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/sphinx_autodoc_typehints/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def _resolve_type_guarded_imports(obj: Any) -> None:
328328
if module:
329329
try:
330330
module_code = inspect.getsource(module)
331-
except OSError:
331+
except (TypeError, OSError):
332332
... # no source code => no type guards
333333
else:
334334
for (_, part) in _TYPE_GUARD_IMPORT_RE.findall(module_code):

0 commit comments

Comments
 (0)