Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion Lib/pydoc.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -1435,7 +1435,8 @@ def makename(c, m=object.__module__):
# List the built-in subclasses, if any:
subclasses=sorted(
(str(cls.__name__) forclsintype.__subclasses__(object)
ifnotcls.__name__.startswith("_") andcls.__module__=="builtins"),
if (notcls.__name__.startswith("_") and
getattr(cls, '__module__', '') =="builtins")),
key=str.lower
)
no_of_subclasses=len(subclasses)
Expand Down
8 changes: 8 additions & 0 deletions Lib/test/test_pydoc/test_pydoc.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -556,6 +556,14 @@ class object
| ... and 82 other subclasses
"""
doc=pydoc.TextDoc()
try:
# Make sure HeapType, which has no __module__ attribute, is one
# of the known subclasses of object. (doc.docclass() used to
# fail if HeapType was imported before running this test, like
# when running tests sequentially.)
from_testcapiimportHeapType
exceptImportError:
pass
text=doc.docclass(object)
snip= (" | Built-in subclasses:\n"
" | async_generator\n"
Expand Down
Loading