gh-104683: Argument clinic: cleanup state_modulename_name()
#107340
Merged
+35
−10
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.
The
state_modulename_name()function has two variables namedmodule, that have different purposes and that are assigned to objects of different types:cpython/Tools/clinic/clinic.py
Line 4718 in 6e850c3
cpython/Tools/clinic/clinic.py
Lines 4746 to 4750 in 6e850c3
If we give the second variable a different name, it makes the code easier to understand for mypy and for humans. I also made some incidental changes to nearby lines to use f-strings rather than string concatenation using
+.(This PR is required in order to add type hints to the last remaining untyped function in
clinic.py,_module_and_class().)Tools/clinic/#104683