Skip to content

Commit 450bcc3

Browse files
committed
Merge remote-tracking branch 'upstream/master' into issue276
2 parents 8b2e439 + 414739b commit 450bcc3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pdoc/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,10 @@ def _pep224_docstrings(doc_obj: Union['Module', 'Class'], *,
258258
_ = inspect.findsource(doc_obj.obj)
259259
tree = ast.parse(doc_obj.source) # type: ignore
260260
except (OSError, TypeError, SyntaxError) as exc:
261-
warn("Couldn't read PEP-224 variable docstrings from {!r}: {}".format(doc_obj, exc))
261+
# Don't emit a warning for builtins that don't have source available
262+
is_builtin = getattr(doc_obj.obj, '__module__', None) == 'builtins'
263+
if not is_builtin:
264+
warn("Couldn't read PEP-224 variable docstrings from {!r}: {}".format(doc_obj, exc))
262265
return {}, {}
263266

264267
if isinstance(doc_obj, Class):

0 commit comments

Comments
 (0)