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

@ -1951,9 +1951,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)
@ -2039,6 +2041,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()
@ -2079,6 +2086,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,