Repository navigation
Call function signature hooks when checking decorators - #22130
Open
Cherith1222 wants to merge 2 commits into
Open
Cherith1222 wants to merge 2 commits into
Cherith1222 wants to merge 2 commits into
Conversation
Decorator calls never reached get_function_signature_hook, so a plugin could not adjust that signature the way a normal call can. AI-assisted (Cursor); not yet reviewed.
for more information, see https://pre-commit.ci
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: scipy-stubs (https://github.com/scipy/scipy-stubs)
- tests/misc/test_submodules_empty.pyi:3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
|
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.
Summary
Decorator calls never reached
get_function_signature_hook, so a plugin could not adjust that signature the way it can for a normal call. Checking a decorator now invokes the hook.Fixes #21904.
Test Plan
On Windows, Python from this checkout's
.venv,PYTEST_DISABLE_PLUGIN_AUTOLOAD=1, Resource Sentinel MEDIUM (1 CPU, 2.5–3 GiB):python -m pytest -o addopts= -p no:cacheprovider mypy/test/testcheck.py::TypeCheckSuite::check-custom-plugin.test -q→ 65 passed.mypy/test/testcheck.py -k decorator→ 112 passed, 8205 deselected.check-functions.test,check-functools.test,check-singledispatch.test,check-plugin-attrs.test,check-dataclasses.test, andcheck-dataclass-transform.test→ 658 passed, 2 xfailed (the two existing-xfailcases incheck-singledispatch.test).Not run: the full mypy suite, mypy_primer, the daemon / fine-grained mode, and mypyc.
AI assistance
Drafted with Cursor. The account owner authorized opening this pull request. A human has not reviewed the diff. There is no
Co-authored-by,Reviewed-by, orSigned-off-bytrailer.