[Python-checkins] r64300 - in python/branches/release25-maint: Lib/test/test_grammar.py Python/ast.c

georg.brandl python-checkins at python.org
Sun Jun 15 21:53:24 CEST 2008


Author: georg.brandl
Date: Sun Jun 15 21:53:12 2008
New Revision: 64300
Log:
#3117: backport r55087, fixes segfault with lambda (None,): None.
Modified:
 python/branches/release25-maint/Lib/test/test_grammar.py
 python/branches/release25-maint/Python/ast.c
Modified: python/branches/release25-maint/Lib/test/test_grammar.py
==============================================================================
--- python/branches/release25-maint/Lib/test/test_grammar.py	(original)
+++ python/branches/release25-maint/Lib/test/test_grammar.py	Sun Jun 15 21:53:12 2008
@@ -277,6 +277,7 @@
 verify(l5(1, 2) == 5)
 verify(l5(1, 2, 3) == 6)
 check_syntax("lambda x: x = 2")
+check_syntax("lambda (None,): None")
 
 ### stmt: simple_stmt | compound_stmt
 # Tested below
Modified: python/branches/release25-maint/Python/ast.c
==============================================================================
--- python/branches/release25-maint/Python/ast.c	(original)
+++ python/branches/release25-maint/Python/ast.c	Sun Jun 15 21:53:12 2008
@@ -249,6 +249,8 @@
 		 goto error;
 asdl_seq_SET(stmts, 0, Pass(n->n_lineno, n->n_col_offset,
 arena));
+ if (!asdl_seq_GET(stmts, 0))
+ goto error;
 return Interactive(stmts, arena);
 }
 else {
@@ -679,6 +681,8 @@
 		 if (NCH(ch) != 1) {
 			/* We have complex arguments, setup for unpacking. */
 			asdl_seq_SET(args, k++, compiler_complex_args(c, ch));
+			if (!asdl_seq_GET(args, k-1))
+			 goto error;
 		 } else {
 			/* def foo((x)): setup for checking NAME below. */
 			/* Loop because there can be many parens and tuple


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /