diff Python/compile.c @ 59672:b879209c202f legacy-trunk

prevent lambda functions from having docstrings #8164
author Benjamin Peterson <benjamin@python.org>
date Wed, 17 Mar 2010 20:41:42 +0000
parents 76cf60e2d005
children d11fbc796499
line wrap: on
line diff
--- a/Python/compile.c	Wed Mar 17 20:05:11 2010 +0000
+++ b/Python/compile.c	Wed Mar 17 20:41:42 2010 +0000
@@ -1518,6 +1518,11 @@
 
 	/* 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);