From 80cf589a26d792820f135591eb8007bca891bf4f Mon Sep 17 00:00:00 2001 From: pgjones Date: Mon, 14 Aug 2023 11:10:15 +0100 Subject: [PATCH] Correct the error handler typing It may also be awaitable, as invocations are wrapped in ensure_sync. --- src/flask/typing.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/flask/typing.py b/src/flask/typing.py index 66bc0a54ee..a8c9ba0425 100644 --- a/src/flask/typing.py +++ b/src/flask/typing.py @@ -77,7 +77,10 @@ # https://github.com/pallets/flask/issues/4095 # https://github.com/pallets/flask/issues/4295 # https://github.com/pallets/flask/issues/4297 -ErrorHandlerCallable = t.Callable[[t.Any], ResponseReturnValue] +ErrorHandlerCallable = t.Union[ + t.Callable[[t.Any], ResponseReturnValue], + t.Callable[[t.Any], t.Awaitable[ResponseReturnValue]], +] RouteCallable = t.Union[ t.Callable[..., ResponseReturnValue],