summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 756a903..8f0fd8d 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)