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

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__.
(cherry picked from commit 7257b24140)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-10-07 21:57:28 +02:00 committed by GitHub
parent b53f46a7b7
commit 103766528f
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))