Skip to content
Myr

Added support for generator_stop

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 b78f261 · Browse files · 2 files+16 added−1 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+16 added−1 removed

  • other:+16 added−1 removed

2 files+16 added−1 removed

modified:jinja2/compiler.py+10 added-1 removed
36 unmodified lines
37 dict_item_iter = 'iteritems'38else:39 dict_item_iter = 'items'4041code_features = ['division']4243# does this python version support generator stops? (PEP 0479)44try:45 exec('from __future__ import generator_stop')46 code_features.append('generator_stop')47except SyntaxError:48 pass495051# does if 0: dummy(x) get us x into the scope?52def unoptimize_before_dead_code():53 x = 4254 def f():
716 unmodified lines
771 assert frame is None, 'no root frame allowed'772 eval_ctx = EvalContext(self.environment, self.name)773774 from jinja2.runtime import __all__ as exported766 self.writeline('from __future__ import division')775 self.writeline('from __future__ import %s' % ', '.join(code_features))776 self.writeline('from jinja2.runtime import ' + ', '.join(exported))777 if not unoptimize_before_dead_code:778 self.writeline('dummy = lambda *x: None')779
916 unmodified lines
modified:CHANGES+6 added
1Jinja2 Changelog2================34Version 2.95-----------67- Added support for `generator_stop` on supported Python versions8 (Python 3.5 and later)910Version 2.8.111-------------1213(unreleased bugfix release)
368 unmodified lines