mirror of
https://github.com/python/cpython.git
synced 2025-07-27 21:24:32 +00:00
#4748 lambda generators shouldn't return values
This commit is contained in:
parent
c3a9803410
commit
8d5934b25d
3 changed files with 18 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue