Skip to content
Myr

Resolved extends errors in async mode (Fixes #668)

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

authored by Armin Ronacher · committed by Armin Ronacher · parent ca124c5 · Browse files · 3 files+10 added−3 removed
This commit

State

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

Diff stats

3 files+10 added−3 removed

  • tests:+4 added−0 removed
  • other:+6 added−3 removed

3 files+10 added−3 removed

modified:jinja2/compiler.py+4 added-3 removed
732 unmodified lines
733 if not self.has_known_extends:734 self.indent()735 self.writeline('if parent_template is not None:')736 self.indent()737 if supports_yield_from:737 if supports_yield_from and not self.environment.is_async:738 self.writeline('yield from parent_template.'739 'root_render_func(context)')740 else:741 self.writeline('for event in parent_template.'742 'root_render_func(context):')741 self.writeline('%sfor event in parent_template.'742 'root_render_func(context):' %743 (self.environment.is_async and 'async ' or ''))744 self.indent()745 self.writeline('yield event')746 self.outdent()747 self.outdent(1 + (not self.has_known_extends))
906 unmodified lines
modified:tests/test_async.py+4 added
462 unmodified lines
463 '<url><loc>/</loc></url>',464 '<url><loc>/bar</loc></url>',465 '</urlset>',466 ]467468 def test_bare_async(self, test_env_async):469 t = test_env_async.from_string('{% extends "header" %}')470 assert t.render(foo=42) == '[42|23]'
modified:CHANGES+2 added
11 unmodified lines
12 regression.13- Correctly use the buffer for the else block of for loops. This caused14 invalid syntax errors to be caused on 2.x and completely wrong behavior15 on Python 3 (#669)16- Resolve an issue where the `{% extends %}` tag could not be used with17 async environments. (#668)1819Version 2.9.420-------------21(bugfix release, released on January 10th 2017)
480 unmodified lines