Fix @takes_callable_and_args TypeVar binding bug#72
Merged
oremanj merged 1 commit intopython-trio:masterfrom Mar 28, 2023
gschaffner:fix-takes_callable_and_args-TypeVar-binding
Merged
Fix @takes_callable_and_args TypeVar binding bug#72oremanj merged 1 commit intopython-trio:masterfrom gschaffner:fix-takes_callable_and_args-TypeVar-binding
@takes_callable_and_args TypeVar binding bug#72oremanj merged 1 commit intopython-trio:masterfrom
gschaffner:fix-takes_callable_and_args-TypeVar-binding
Conversation
belm0
reviewed
Feb 15, 2023
Comment on lines
-466
to
+470
| variables=( | ||
| list(callable_ty.variables) | ||
| + cast(List[TypeVarLikeType], type_var_types) | ||
| ), | ||
| # Note that we do *not* append `type_var_types` to | ||
| # `callable_ty.variables`. Even though `*type_var_types` are in our new | ||
| # `callable_ty`'s argument types, they are *not* type variables that get | ||
| # bound when our new `callable_ty` gets called. They get bound when the | ||
| # `expanded_fn` that references our new `callable_ty` gets called. |
Member
There was a problem hiding this comment.
Will this fix, in turn, cause errors from older mypy?
Member
|
I tested the new code against an old mypy (0.982) and it produced the same correct-looking reveal_type output. It also seems to type-check correctly. Going to land it and hope for the best. |
Member
Author
|
sorry for the delay! but yeah, this should be fine on older mypy versions. in particular |
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.
resolves #71.
the change in the plugin's behavior bisects to python/mypy#14095, which changes the signature generated by the plugin:
before:
after:
that is, what used to be one
__T1binding is now two different ones!cc @oremanj, as this is your code :)
if merged, a new release should probably be made as this is effecting people in the wild.