``Template.generate_async``. :pr:`1960`
- Avoid leaving async generators unclosed in blocks, includes and extends.
:pr:`1960`
+- The runtime uses the correct ``concat`` function for the current environment
+ when calling block references. :issue:`1701`
Version 3.1.4
@internalcode
async def _async_call(self) -> str:
- rv = concat(
+ rv = self._context.environment.concat( # type: ignore
[x async for x in self._stack[self._depth](self._context)] # type: ignore
)
if self._context.environment.is_async:
return self._async_call() # type: ignore
- rv = concat(self._stack[self._depth](self._context))
+ rv = self._context.environment.concat( # type: ignore
+ self._stack[self._depth](self._context)
+ )
if self._context.eval_ctx.autoescape:
return Markup(rv)
result = t.render()
assert result == 2
assert isinstance(result, int)
+
+
+def test_block(env):
+ t = env.from_string(
+ "{% block b %}{% for i in range(1) %}{{ loop.index }}{% endfor %}"
+ "{% endblock %}{{ self.b() }}"
+ )
+ result = t.render()
+ assert result == 11
+ assert isinstance(result, int)