summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-03-17 20:41:42 +0000
committerBenjamin Peterson <benjamin@python.org>2010-03-17 20:41:42 +0000
commit3cf51a166e382a447e0d3cc7370713320faf2f3a (patch)
tree4279fcb3b1e90b55a7976df9d1cc9b6afe9a6f8b /Python/compile.c
parent37a0d0061812d42becb0af2deeeeb114979fc86e (diff)
downloadcpython-3cf51a166e382a447e0d3cc7370713320faf2f3a.tar.gz
prevent lambda functions from having docstrings #8164
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 4ea2ee9afe..12210e1296 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1518,6 +1518,11 @@ compiler_lambda(struct compiler *c, expr_ty e)
/* unpack nested arguments */
compiler_arguments(c, args);
+
+ /* 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);
VISIT_IN_SCOPE(c, expr, e->v.Lambda.body);