From 46b39e2698697408c6f8f8693e526cd1bb085684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bojan=20Deli=C4=87?= Date: Thu, 7 Oct 2021 01:09:32 +0200 Subject: [PATCH] fix errorhandler type check --- CHANGES.rst | 1 + src/flask/typing.py | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 98139ae0..db65ee16 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -9,6 +9,7 @@ Unreleased removed in Werkzeug 2.1. It is now also deprecated in Flask, to be removed in Flask 2.1, while remaining compatible with both in 2.0.x. Use ``response.request.environ`` instead. :pr:`4341` +- Fix type annotation for ``errorhandler`` decorator. :issue:`4295` Version 2.0.2 diff --git a/src/flask/typing.py b/src/flask/typing.py index f1c84670..93896f80 100644 --- a/src/flask/typing.py +++ b/src/flask/typing.py @@ -46,11 +46,4 @@ TemplateGlobalCallable = t.Callable[..., t.Any] TemplateTestCallable = t.Callable[..., bool] URLDefaultCallable = t.Callable[[str, dict], None] URLValuePreprocessorCallable = t.Callable[[t.Optional[str], t.Optional[dict]], None] - - -if t.TYPE_CHECKING: - import typing_extensions as te - - class ErrorHandlerCallable(te.Protocol[GenericException]): - def __call__(self, error: GenericException) -> ResponseReturnValue: - ... +ErrorHandlerCallable = t.Callable[[GenericException], ResponseReturnValue]