]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
The list comp patch checked for the second child node of the 'listmaker'
authorThomas Wouters <thomas@python.org>
Sun, 13 Aug 2000 17:05:17 +0000 (17:05 +0000)
committerThomas Wouters <thomas@python.org>
Sun, 13 Aug 2000 17:05:17 +0000 (17:05 +0000)
node, without checking if the node actually had more than one child. It can
have only one node, though: '[' test ']'. This fixes it.

Python/compile.c

index adefb4fbbabec07f8c943b9d54758d96d0177432..476f1f20bfa04ccfbb696b6559072487c3898d25 100644 (file)
@@ -1045,7 +1045,7 @@ static void
 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;