Repository navigation
Read stubgen documentation once per run - #22379
Open
den-run-ai wants to merge 1 commit into
Open
den-run-ai wants to merge 1 commit into
den-run-ai wants to merge 1 commit into
Conversation
agammann
reviewed
Nov 7, 2026
agammann
left a comment
There was a problem hiding this comment.
I checked the loader’s lifetime and call paths. The cached loader is created inside generate_stubs, so C modules in one run share the parsed documentation index while a later invocation reloads changed docs. Direct callers of generate_stub_for_c_module still use its uncached default. The two-module/two-invocation test covers both reuse and invalidation. I did not run the full suite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #22370.
Reuse the external signature index across C modules within one stubgen invocation. Keep loading lazy and scoped to the invocation so later runs pick up documentation changes.
With four C modules and 319 documentation files, file reads fall from 1,276 to 319. Benchmark details are in the issue.
Add a regression test covering reuse across modules and documentation changes between invocations.
Validation: 379 stubgen tests passed (1 skipped, 2 xfailed); serial self-check (196 files); Black and Ruff.