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

Closed
unicodestrangely opened this issue Jan 24, 2017 · 1 comment

Comments

@unicodestrangely
Copy link

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=[])
u'0'

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/environment.py", line 945, in __new__
    return env.from_string(source, template_class=cls)
  File "/home/ustr/environ/local/lib/python2.7/site-packages/jinja2/environment.py", 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/environment.py", line 588, in compile
    return self._compile(source, filename)
  File "/home/ustr/environ/local/lib/python2.7/site-packages/jinja2/environment.py", 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

@untitaker

This comment has been minimized.

Copy link
Member

commented Jan 24, 2017

Confirmed regression!

@mitsuhiko mitsuhiko closed this in ca124c5 Jan 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.