Handle functools.Placeholder in partial#21399
Open
MestreY0d4-Uninter wants to merge 1 commit intopython:masterfrom
Open
Handle functools.Placeholder in partial#21399MestreY0d4-Uninter wants to merge 1 commit intopython:masterfrom
MestreY0d4-Uninter wants to merge 1 commit intopython:masterfrom
Conversation
This comment has been minimized.
This comment has been minimized.
36a0b07 to
6bc619f
Compare
Author
|
Pushed 6bc619f to address the mypy_primer INTERNAL ERROR: the partial plugin now avoids direct type-var inference on Unpack/TypeVarTuple arguments while keeping the Placeholder narrowing path. Local validation:
|
Contributor
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
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 #21313.
Summary
This updates the
functools.partialplugin to treatfunctools.Placeholderas an unbound positional slot instead of a normal bound argument.The generated partial signature now keeps placeholder-backed parameters available for later calls, while still using non-placeholder arguments for type inference.
Test plan
PYTHONPATH=. uv run --no-project --isolated --with-requirements test-requirements.txt python -m pytest -q mypy/test/testcheck.py::TypeCheckSuite::check-functools.testPYTHONPATH=. uv run --no-project --isolated --with-requirements test-requirements.txt python -m mypy --config-file mypy_self_check.ini mypy/plugins/functools.py