summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-12-27 18:24:11 +0000
committerBenjamin Peterson <benjamin@python.org>2008-12-27 18:24:11 +0000
commit8d5934b25d7c3e636444428dc715316a08b8c94e (patch)
treea1e10950058a0271d0b15d385a8edcb4c4814595 /Python/compile.c
parentc3a98034106502a661281c5198ed818849591d40 (diff)
downloadcpython-git-8d5934b25d7c3e636444428dc715316a08b8c94e.tar.gz
#4748 lambda generators shouldn't return values
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 756a903340..8f0fd8d043 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1534,7 +1534,12 @@ compiler_lambda(struct compiler *c, expr_ty e)
c->u->u_argcount = asdl_seq_LEN(args->args);
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)