From 625963eca8979746427b601d415adc08552b41cc Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 3 May 2009 13:04:56 +0200 Subject: [PATCH] fix parser grammar for lambdas in lambdas --- Cython/Compiler/Parsing.py | 2 +- tests/run/lambda_T195.pyx | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py index ba346131..d651c541 100644 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@ -108,7 +108,7 @@ def p_lambdef(s, allow_conditional=True): args, star_arg, starstar_arg = p_varargslist(s, terminator=':') s.expect(':') if allow_conditional: - expr = p_test(s) + expr = p_simple_expr(s) else: expr = p_test_nocond(s) return ExprNodes.LambdaNode( diff --git a/tests/run/lambda_T195.pyx b/tests/run/lambda_T195.pyx index 59168d55..32481108 100644 --- a/tests/run/lambda_T195.pyx +++ b/tests/run/lambda_T195.pyx @@ -24,6 +24,9 @@ __doc__ = u""" 11 >>> make_const_calc1_xy(8)(2) 27 + +>>> make_lambda_lambda(1)(2)(4) +7 """ #cy_identity = lambda x:x @@ -46,3 +49,6 @@ def make_const_calc1(): def make_const_calc1_xy(x): return lambda y: x*y+(1*2*3+5) + +def make_lambda_lambda(x): + return lambda y : lambda z:x+y+z -- 2.26.2