[red-knot] Check assignability of bound methods to callables#17430
[red-knot] Check assignability of bound methods to callables#17430dhruvmanila merged 1 commit intomainfrom
Conversation
|
|
(Checking the ecosystem diff...) |
|
They look mostly correct as most of them expected a gradual callable type and received bound methods. Earlier, this would be delegated to There's this additional warning about unused suppression comment which I want to look closely at: https://github.com/pallets/werkzeug/blob/7868bef5d978093a8baa0784464ebe5d775ae92a/src/werkzeug/local.py#L370. |
This also seems correct because otherwise (without this PR) we get the following diagnostic: which seems like a clear false positive that's now is fixed and thus does not require a It seems like another win for a thorough descriptor protocol implementation from @sharkdp! |
sharkdp
left a comment
There was a problem hiding this comment.
As discussed on Discord, the ecosystem change looks good to me — thank you!
For context:
|
Summary
This is similar to #17095, it adds assignability check for bound methods to callables.
Test Plan
Add test cases to for assignability; specifically it uses gradual types because otherwise it would just delegate to
is_subtype_of.