-
Hi, With the following sample, I have the following error: from typing import Protocol, TypeVar, Type
SE = TypeVar('SE', bound=Exception)
TE = TypeVar('TE', bound=Exception)
class ExceptionMapper(Protocol[TE]):
def __call__(self, source_exception: Exception, t_exc_class: Type[TE]) -> TE: ...
def default_mapper(s_exc: Exception, t_exc_class: Type[TE]) -> TE: ...
def with_map_exceptions(
s_exc_class: Exception,
t_exc_class: Type[TE],
mapper: ExceptionMapper[TE] = default_mapper
): ... sample.py:13:102 - error: Expression of type "(s_exc: Exception, t_exc_class: Type[TE@default_mapper]) -> TE@default_mapper" cannot be assigned to parameter of type "ExceptionMapper[TE@with_map_exceptions]"
Parameter name mismatch: "source_exception" versus "s_exc"
Function return type "TE@default_mapper" is incompatible with type "TE@with_map_exceptions"
Type "Type[TE@default_mapper]" cannot be assigned to type "TE@default_mapper" (reportGeneralTypeIssues) I'm not sure how to interpret the error message - I don't understand where This is with Thanks for your help! |
Beta Was this translation helpful? Give feedback.
Answered by
erictraut
Apr 27, 2021
Replies: 1 comment
-
This is a bug in the constraint solver. Thanks for the bug report. It will be fixed in the next release. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
d-tw
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a bug in the constraint solver. Thanks for the bug report. It will be fixed in the next release.