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

Using lambda as default argument breaks #190

Closed
sqlalchemy-bot opened this Issue May 22, 2012 · 3 comments

Comments

Projects
None yet
1 participant
@sqlalchemy-bot

sqlalchemy-bot commented May 22, 2012

Migrated issue, originally created by Anonymous

Running this code:

from mako.template import Template

TEXT = """\
<%def name="foo(bar=lambda x, y: x + y)">
    bar(4700, 11)
</%def>

${foo()}
"""

print(Template(TEXT).render())

...results in:

Traceback (most recent call last):
  File "tmp/mako-test/test.py", line 11, in <module>
    print(Template(TEXT).render())
  File "/usr/lib64/python3.2/site-packages/mako/template.py", line 258, in __init__
    (code, module) = _compile_text(self, text, filename)
  File "/usr/lib64/python3.2/site-packages/mako/template.py", line 606, in _compile_text
    code = compile(source, cid, 'exec')
  File "memory:0x7f5927b35ed0", line 18
    def foo(bar=lambda , : (x + y)):
                       ^
SyntaxError: invalid syntax

Expected output:

4711

Tested on version 0.7.0.

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Aug 3, 2013

Michael Bayer (@zzzeek) wrote:

OK key fact, needs to be python 3 for the failure to occur

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Aug 3, 2013

Michael Bayer (@zzzeek) wrote:

542ad00

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Aug 3, 2013

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment