Skip to content

Commit 7e53887

Browse files
committed
BUG: Make Doc.source handle unexpected AttributeError
Fixes #459
1 parent 46d3291 commit 7e53887

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pdoc/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,11 @@ def __repr__(self):
566566
def source(self) -> str:
567567
"""
568568
Cleaned (dedented) source code of the Python object. If not
569-
available, an empty string.
569+
available for whatever reason, an empty string.
570570
"""
571571
try:
572572
lines, _ = inspect.getsourcelines(_unwrap_descriptor(self))
573-
except (ValueError, TypeError, OSError):
573+
except (ValueError, TypeError, OSError, AttributeError):
574574
return ''
575575
return inspect.cleandoc(''.join(['\n'] + lines))
576576

0 commit comments

Comments
 (0)