gh-139076: Fix regression in pydoc not showing extension functions (GH-139077)

Fix a bug in the pydoc module that was hiding functions in a Python
module if they were implemented in an extension module and the module did
not have __all__.
This commit is contained in:
Serhiy Storchaka 2025-09-19 15:54:06 +03:00 committed by GitHub
parent b36dee855d
commit 7257b24140
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 0 deletions

View file

@ -884,6 +884,7 @@ def docmodule(self, object, name=None, mod=None, *ignored):
for key, value in inspect.getmembers(object, inspect.isroutine):
# if __all__ exists, believe it. Otherwise use a heuristic.
if (all is not None
or inspect.isbuiltin(value)
or (inspect.getmodule(value) or object) is object):
if visiblename(key, all, object):
funcs.append((key, value))
@ -1328,6 +1329,7 @@ def docmodule(self, object, name=None, mod=None, *ignored):
for key, value in inspect.getmembers(object, inspect.isroutine):
# if __all__ exists, believe it. Otherwise use a heuristic.
if (all is not None
or inspect.isbuiltin(value)
or (inspect.getmodule(value) or object) is object):
if visiblename(key, all, object):
funcs.append((key, value))