Skip to content

Commit c4e6e0c

Browse files
committed
Compare a module's own docstring
extra_info() reports a docstring for callables, and a module is not one, so the __doc__ item both sides record was None and a module docstring never counted as a mismatch. Reading it with getdoc(), as a callable's is read, finds three: base64 and imaplib cite different RFCs than CPython's copies do, and sys describes itself differently. Non-callables keep reporting None. getdoc() on a plain value answers with its type's docstring, which would turn every string constant into a mismatch. Assisted-by: Claude Code:claude-opus-5
1 parent ae94481 commit c4e6e0c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎scripts/whats_left.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ def dir_of_mod_or_error(module_name, keep_other=True):
311311
# what was inspected before.
312312
if item_name == "__builtins__":
313313
continue
314+
if item_name == "__doc__":
315+
# extra_info() reports a docstring for a callable only, and a module
316+
# is not one. getdoc() matches how a callable's is normalized.
317+
result[item_name] = {"sig": None, "doc": inspect.getdoc(module)}
318+
continue
314319
item = getattr(module, item_name)
315320
# don't repeat items imported from other modules
316321
if keep_other or is_child(module, item) or inspect.getmodule(item) is None:

0 commit comments

Comments
 (0)