[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

@ -1939,9 +1939,11 @@ def test_text_doc_routines_in_class(self, cls=pydocfodder.B):
if not support.MISSING_C_DOCSTRINGS:
self.assertIn(' | get(key, default=None, /) method of builtins.dict instance', lines)
self.assertIn(' | dict_get = get(key, default=None, /) method of builtins.dict instance', lines)
self.assertIn(' | sin(x, /)', lines)
else:
self.assertIn(' | get(...) method of builtins.dict instance', lines)
self.assertIn(' | dict_get = get(...) method of builtins.dict instance', lines)
self.assertIn(' | sin(...)', lines)
lines = self.getsection(result, f' | Class methods {where}:', ' | ' + '-'*70)
self.assertIn(' | B_classmethod(x)', lines)
@ -2027,6 +2029,11 @@ def test_text_doc_routines_in_module(self):
self.assertIn(' __repr__(...) unbound builtins.object method', lines)
self.assertIn(' object_repr = __repr__(...) unbound builtins.object method', lines)
# builtin functions
if not support.MISSING_C_DOCSTRINGS:
self.assertIn(' sin(x, /)', lines)
else:
self.assertIn(' sin(...)', lines)
def test_html_doc_routines_in_module(self):
doc = pydoc.HTMLDoc()
@ -2067,6 +2074,12 @@ def test_html_doc_routines_in_module(self):
self.assertIn(' __repr__(...) unbound builtins.object method', lines)
self.assertIn(' object_repr = __repr__(...) unbound builtins.object method', lines)
# builtin functions
if not support.MISSING_C_DOCSTRINGS:
self.assertIn(' sin(x, /)', lines)
else:
self.assertIn(' sin(...)', lines)
@unittest.skipIf(
is_wasm32,