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
This is a typeshed issue. The problem is that BaseException.__init__ in stdlib/3/builtins.pyi is defined as def __init__(self, *args: object) -> None: .... This means it takes arbitrary args, but not arbitrary kwargs, and your code passes **kwargs. The fix is obvious; could you submit a PR or issue to https://github.com/python/typeshed to fix it?
Trying to add hints to this:
gives:
Well,
Exception.__init__
supposedly takes*args, **kwargs
so how can this ever have "too many arguments"?If I change my code to:
then no error reported.
I'm actually happy with this change to my code. But does it suggest an issue with mypy?
This also works:
So it seems the issue is not with any specific number of arguments, but of mypy not understanding that
*args
means 'any number'?The text was updated successfully, but these errors were encountered: