Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.9 regression: SyntaxError in recursive for loop with else clause #669

unicodestrangely opened this issue Jan 24, 2017 · 1 comment


Copy link

@unicodestrangely unicodestrangely commented Jan 24, 2017

Linux Mint 17.3 64-bit
Python 2.7.6

Jinja 2.8.1:

>>> import jinja2
>>> jinja2.Template('{% for value in values recursive %}1{% else %}0{% endfor %}').render(values=[])

Jinja 2.9-2.9.4:

>>> import jinja2
>>> jinja2.Template('{% for value in values recursive %}1{% else %}0{% endfor %}').render(values=[])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ustr/environ/local/lib/python2.7/site-packages/jinja2/", line 945, in __new__
    return env.from_string(source, template_class=cls)
  File "/home/ustr/environ/local/lib/python2.7/site-packages/jinja2/", line 880, in from_string
    return cls.from_code(self, self.compile(source), globals, None)
  File "/home/ustr/environ/local/lib/python2.7/site-packages/jinja2/", line 588, in compile
    return self._compile(source, filename)
  File "/home/ustr/environ/local/lib/python2.7/site-packages/jinja2/", line 551, in _compile
    return compile(source, filename, 'exec')
  File "<template>", line 25
SyntaxError: 'return' with argument inside generator
@untitaker untitaker added the bug label Jan 24, 2017
Copy link

@untitaker untitaker commented Jan 24, 2017

Confirmed regression!


@mitsuhiko mitsuhiko closed this in ca124c5 Jan 24, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants