diff Python/compile.c @ 13956:8e8a8df0fe73 legacy-trunk

The list comp patch checked for the second child node of the 'listmaker' node, without checking if the node actually had more than one child. It can have only one node, though: '[' test ']'. This fixes it.
author Thomas Wouters <thomas@python.org>
date Sun, 13 Aug 2000 17:05:17 +0000
parents afdb3f485d8f
children 716e1c4e3f78
line wrap: on
line diff
--- a/Python/compile.c	Sun Aug 13 11:59:08 2000 +0000
+++ b/Python/compile.c	Sun Aug 13 17:05:17 2000 +0000
@@ -1045,7 +1045,7 @@
 com_listmaker(struct compiling *c, node *n)
 {
 	/* listmaker: test ( list_iter | (',' test)* [','] ) */
-	if (TYPE(CHILD(n, 1)) == list_iter)
+	if (NCH(n) > 1 && TYPE(CHILD(n, 1)) == list_iter)
 		com_list_comprehension(c, n);
 	else {
 		int len = 0;