Skip to content
Myr

Merge pull request #1516 from mohd-akram/async-perf

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Reduce async overhead due to auto_await

authored by David Lord · committed by GitHub · parents 99b6fc7, b756b19 · Browse files · 2 files+9 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+9 added−0 removed

  • other:+9 added−0 removed

2 files+9 added−0 removed

modified:src/jinja2/async_utils.py+7 added
42 unmodified lines
4344 return decorator454647_common_primitives = {int, float, bool, str, list, dict, tuple, type(None)}484950async def auto_await(value: t.Union[t.Awaitable["V"], "V"]) -> "V":51 # Avoid a costly call to isawaitable52 if type(value) in _common_primitives:53 return t.cast("V", value)5455 if inspect.isawaitable(value):56 return await t.cast("t.Awaitable[V]", value)5758 return t.cast("V", value)
17 unmodified lines
modified:CHANGES.rst+2 added
7 unmodified lines
8- Fix traceback rewriting internals for Python 3.10 and 3.11.9 :issue:`1535`10- Fix how the native environment treats leading and trailing spaces11 when parsing values on Python 3.10. :pr:`1537`12- Improve async performance by avoiding checks for common types.13 :issue:`1514`141516Version 3.0.217-------------
894 unmodified lines