You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "foo.py", line 12, in <module>: Function run_func was called with the wrong arguments [wrong-arg-types]
Expected: (func: FuncTemplate)
Actually passed: (func: Callable[[], Any])
This is happening because we convert the __call__ method to a Callable type for matching. But if the method contains any elements (like kwonly parameters) that can't be represented with a Callable, we just lose that information. We already have some better method-matching code that we're using for signature compatibility checks; let me see if I can reuse that here instead of the Callable approach.
This is a little more work than I hoped it would be =/ The signature compatibility checks mostly work as a drop-in replacement, but they don't handle TypeVar substitutions, which are the trickiest part of matching. I'm going to unassign myself for now.
Hi all!
Here's an example of a simple
Protocol
being used to detect that we're passing a function with the wrong arguments:As expected, this gives an error:
But if we make the
Protocol
kwarg-only:Then the
Protocol
seems to be ignored:It also seems to be ignored when there's a positional arg in additional to a kwarg-only arg:
Any idea what might be going on here? Is this a bug, or is there some subtlety about how kwarg-only functions work?
Thanks!
The text was updated successfully, but these errors were encountered: