Conversation
Not even Callable[[Any, Any],Any] can be used because mypy collapses functions with different argument types to "function" in dicts and lists.
|
I think this is what I would do if we were doing things from scratch and could accept a I also think we don’t care about typing our internals for complex cases like this; anys is fine. |
|
Well, it is always possible to introduce new keyword arguments without breaking backwards compatibility. it is really the |
|
A separate |
|
I'm closing this given that we had a long discussion about it already: #1456. |
|
Well, that discussion is closed too, and what remains is that the type of the Isn't it possible to build some consensus on how to move forward? Adding a new keyword for example which takes a list of exception handlers which are creted separately? I'll be happy to help. Edit: Well, #2042 at contains an immediate fix to the api typing. |
In PR #2042 I pointed out problems with type checking of exception_handlers. Due to untyped handler functions in the unit tests, we didn't catch the fact that handlers were not conforming to the type hints after the support for handling WebSockets errors was added.
This PR aims to help this situation by introducing an
ExceptionHandlerclass which wraps the handler function and provides proper type checking on the handler function. Unwrapped functions with the previous signature are still accepted as a fallback.