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

Using lambda as default argument breaks #190

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

Using lambda as default argument breaks #190

sqlalchemy-bot opened this issue May 22, 2012 · 3 comments
Labels
bug Something isn't working compiler low priority

Comments

@sqlalchemy-bot
Copy link

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
Copy link
Author

Michael Bayer (@zzzeek) wrote:

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

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

542ad00

@sqlalchemy-bot
Copy link
Author

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
Labels
bug Something isn't working compiler low priority
Projects
None yet
Development

No branches or pull requests

1 participant