diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-12-27 19:03:36 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-12-27 19:03:36 (GMT) |
commit | 371ccfb5f5552d0c6abe501072aad0df9293f6fb (patch) | |
tree | 006ef6bf0b4a3f47ff241a6abfbad9799826832b /Python | |
parent | 5cdee16e1f3be00e52d3c7be91752bd2d19f478c (diff) | |
download | cpython-371ccfb5f5552d0c6abe501072aad0df9293f6fb.zip cpython-371ccfb5f5552d0c6abe501072aad0df9293f6fb.tar.gz cpython-371ccfb5f5552d0c6abe501072aad0df9293f6fb.tar.bz2 |
Merged revisions 67954 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67954 | benjamin.peterson | 2008-12-27 12:24:11 -0600 (Sat, 27 Dec 2008) | 1 line
#4748 lambda generators shouldn't return values
........
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c index 36f8c13..e50c75c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1704,7 +1704,12 @@ compiler_lambda(struct compiler *c, expr_ty e) c->u->u_argcount = asdl_seq_LEN(args->args); c->u->u_kwonlyargcount = asdl_seq_LEN(args->kwonlyargs); VISIT_IN_SCOPE(c, expr, e->v.Lambda.body); - ADDOP_IN_SCOPE(c, RETURN_VALUE); + if (c->u->u_ste->ste_generator) { + ADDOP_IN_SCOPE(c, POP_TOP); + } + else { + ADDOP_IN_SCOPE(c, RETURN_VALUE); + } co = assemble(c, 1); compiler_exit_scope(c); if (co == NULL) |