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
{{ message }}
Repository navigation
Overload on Optional[str] and bytes fails with arg of type Union[str, bytes] #5204
Yeah, union math currently tries to handle only signatures where the argument kinds are all the same -- I wasn't sure how to go about unioning together callables that contain some crazy mixture of keyword arguments, name-only arguments, *args, **kwargs so decided to go for simplicity.
I don't think it would be too hard to extend the current logic so it handles the case where one kind is a positional and the other is an optional. I can add that to my TODO list.
Activity
ilevkivskyi commentedon Jun 12, 2018
Hm, if I remove the default value then it works:
So must be some unnecessary restriction on arg kinds in union math and so probably easy to fix.
Michael0x2a commentedon Jun 15, 2018
Yeah, union math currently tries to handle only signatures where the argument kinds are all the same -- I wasn't sure how to go about unioning together callables that contain some crazy mixture of keyword arguments, name-only arguments, *args, **kwargs so decided to go for simplicity.
I don't think it would be too hard to extend the current logic so it handles the case where one kind is a positional and the other is an optional. I can add that to my TODO list.
Relax union math logic to allow signatures with different arg kinds
Relax union math logic to allow signatures with different arg kinds
Relax union math logic to allow signatures with different arg kinds
Relax union math logic to allow signatures with different arg kinds (#…