summaryrefslogtreecommitdiff
path: root/src/jinja2/compiler.py
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2021-04-10 16:12:25 -0700
committerDavid Lord <davidism@gmail.com>2021-04-10 16:12:25 -0700
commit1932ce3dc44e16394888cf04666d9b7a1795da76 (patch)
tree240f231e7ca27ae18fa35855ea3d4a4a7eddcca1 /src/jinja2/compiler.py
parenta9b06f4bd271de7f56347f602dd90b41c3db8327 (diff)
downloadjinja2-1932ce3dc44e16394888cf04666d9b7a1795da76.tar.gz
async support doesn't require patchinginline-async
Diffstat (limited to 'src/jinja2/compiler.py')
-rw-r--r--src/jinja2/compiler.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/jinja2/compiler.py b/src/jinja2/compiler.py
index 1d73f7d..b15fb67 100644
--- a/src/jinja2/compiler.py
+++ b/src/jinja2/compiler.py
@@ -727,16 +727,15 @@ class CodeGenerator(NodeVisitor):
assert frame is None, "no root frame allowed"
eval_ctx = EvalContext(self.environment, self.name)
- from .runtime import exported
-
- self.writeline("from __future__ import generator_stop") # Python < 3.7
- self.writeline("from jinja2.runtime import " + ", ".join(exported))
+ from .runtime import exported, async_exported
if self.environment.is_async:
- self.writeline(
- "from jinja2.asyncsupport import auto_await, "
- "auto_aiter, AsyncLoopContext"
- )
+ exported_names = sorted(exported + async_exported)
+ else:
+ exported_names = sorted(exported)
+
+ self.writeline("from __future__ import generator_stop") # Python < 3.7
+ self.writeline("from jinja2.runtime import " + ", ".join(exported_names))
# if we want a deferred initialization we cannot move the
# environment into a local name