Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 50308:93da9f14e5b5 legacy-trunk
#4748 lambda generators shouldn't return values
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sat, 27 Dec 2008 18:24:11 +0000 |
| parents | 94e79d78dff0 |
| children | e158c70511fe |
line wrap: on
line diff
--- a/Python/compile.c Sat Dec 27 18:20:04 2008 +0000 +++ b/Python/compile.c Sat Dec 27 18:24:11 2008 +0000 @@ -1534,7 +1534,12 @@ 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)
