Repository navigation
Drop the unused get_mod_state_by_cls() helper - #1520
Merged
asvetlov merged 1 commit intoSep 22, 2026
Merged
Conversation
The helper has had no call sites since it was introduced; module state is reached through get_mod_state(), get_mod_state_by_def() and get_mod_state_by_def_checked() everywhere in the extension. Dropping it also leaves PyType_GetModuleState() unused.
asvetlov
marked this pull request as ready for review
September 22, 2026 22:12
Contributor
|
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.
What do these changes do?
get_mod_state_by_cls()inmultidict/_multilib/state.hhas no callsites anywhere in the tree, so it is removed. Module state is reached
through
get_mod_state(),get_mod_state_by_def()andget_mod_state_by_def_checked()everywhere in the extension. Droppingthe helper also leaves
PyType_GetModuleState()with no remaininguser; no include becomes unnecessary, since
state.hgets thatdeclaration from
Python.h.C extension only; the pure-Python backend has no equivalent and needs
no matching change.
Are there changes in behavior for the user?
No. The helper was never reachable from Python.
Is it a substantial burden for the maintainers to support this?
No, it removes code.
Related issue number
None. Split out of #1518 so that pull request stays one logical change.
Checklist
CONTRIBUTORS.txt— N/A, no such file in this repoCHANGES/foldermake doc-spellingpasses and any new technical words are added todocs/spelling_wordlist.txtDrafted with Claude Code (Opus 5); reviewed by @asvetlov.
Agent run details (optional, for reviewers)
Verification that the helper is unreferenced:
(only the news fragment, after the deletion).
grep -rn "PyType_GetModuleState"over*.c/*.hexcluding the vendoredpythoncapi_compat.hreturns nothing afterwards.Both backends, run after rebasing onto
1cdd934(#1518):C extension, CPython 3.14.7t
Pure Python
Docs
pre-commit runover the changed files: clang-format and thechangelog
:user:role check both pass.