Skip to content

Commit db128ba

Browse files
committed
Merge upstream changes into 'main' by GitHub Actions
2 parents 561ab41 + 0ce270d commit db128ba

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

CHANGES.rst

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Unreleased
1616
- Fix type annotation for ``teardown_request``. :issue:`4093`
1717
- Fix type annotation for ``before_request`` and ``before_app_request``
1818
decorators. :issue:`4104`
19+
- Fixed the issue where typing requires template global
20+
decorators to accept functions with no arguments. :issue:`4098`
1921

2022

2123
Version 2.0.1

docs/async-await.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Using ``async`` and ``await``
77

88
Routes, error handlers, before request, after request, and teardown
99
functions can all be coroutine functions if Flask is installed with the
10-
``async`` extra (``pip install flask[async]``). This allows views to be
10+
``async`` extra (``pip install flask[async]``). It requires Python 3.7+
11+
where ``contextvars.ContextVar`` is available. This allows views to be
1112
defined with ``async def`` and use ``await``.
1213

1314
.. code-block:: python

docs/installation.rst

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Python Version
88
We recommend using the latest version of Python. Flask supports Python
99
3.6 and newer.
1010

11+
``async`` support in Flask requires Python 3.7+ for ``contextvars.ContextVar``.
12+
1113

1214
Dependencies
1315
------------

src/flask/typing.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
ErrorHandlerCallable = t.Callable[[Exception], ResponseReturnValue]
4141
TeardownCallable = t.Callable[[t.Optional[BaseException]], None]
4242
TemplateContextProcessorCallable = t.Callable[[], t.Dict[str, t.Any]]
43-
TemplateFilterCallable = t.Callable[[t.Any], str]
44-
TemplateGlobalCallable = t.Callable[[], t.Any]
45-
TemplateTestCallable = t.Callable[[t.Any], bool]
43+
TemplateFilterCallable = t.Callable[..., t.Any]
44+
TemplateGlobalCallable = t.Callable[..., t.Any]
45+
TemplateTestCallable = t.Callable[..., bool]
4646
URLDefaultCallable = t.Callable[[str, dict], None]
4747
URLValuePreprocessorCallable = t.Callable[[t.Optional[str], t.Optional[dict]], None]

0 commit comments

Comments
 (0)