Fix eval_call_with_types vararg annotations#117
Open
iliyasone wants to merge 2 commits into
Open
Conversation
eval_call_with_types accepts individual type objects as positional and keyword arguments, but its annotation described each *arg as a tuple and each **kwarg value as a dict. That made mypy reject valid calls such as eval_call_with_types(func, User) and encouraged tuple-wrapping that does not match the runtime binding contract. Update the public signature to annotate each supplied type object directly and add a regression test that is checked by the mypy test harness for both positional and keyword type objects. Validation: uv run pytest; uv run ruff check .; uv run ruff format --check .; uv run mypy --config-file pyproject.toml typemap
The eval_call_with_types regression tests need typed pytest function bodies so mypy checks the calls inside them. Without return annotations, mypy skips those bodies under the current config, so reverting the public signature is not caught by the mypy harness. Annotate the regression test functions with -> None. Verified that the old tuple/dict vararg signature now fails both direct mypy on the test file and the pytest-driven mypy harness, while the fixed signature passes. Validation: uv run pytest; uv run ruff check .; uv run ruff format --check .; uv run mypy --config-file pyproject.toml tests/test_eval_call_with_types_signature.py
|
@iliyasone is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
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.
eval_call_with_typesaccepts individual type objects as positional and keyword arguments, but its annotation described each*argas a tuple and each**kwargvalue as a dict. That made mypy reject valid calls such aseval_call_with_types(func, User)and encouraged tuple-wrapping that does not match the runtime binding contract.Update the public signature to annotate each supplied type object directly and add a regression test that is checked by the mypy test harness for both positional and keyword type objects.
Validation:
Now something like this will not fail mypy check: