Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 59673:52479e0454e9
Merged revisions 79034 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79034 | benjamin.peterson | 2010-03-17 15:41:42 -0500 (Wed, 17 Mar 2010) | 1 line
prevent lambda functions from having docstrings #8164
........
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Wed, 17 Mar 2010 20:56:58 +0000 |
| parents | b0fc54c5d234 |
| children | cab14be0ada1 |
line wrap: on
line diff
--- a/Python/compile.c Wed Mar 17 20:29:51 2010 +0000 +++ b/Python/compile.c Wed Mar 17 20:56:58 2010 +0000 @@ -1660,6 +1660,11 @@ if (!compiler_enter_scope(c, name, (void *)e, e->lineno)) return 0; + /* Make None the first constant, so the lambda can't have a + docstring. */ + if (compiler_add_o(c, c->u->u_consts, Py_None) < 0) + return 0; + 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);
