From 87df80d542b5bc0adeca2c864b6db19afe7f64aa Mon Sep 17 00:00:00 2001 From: Thomas Wouters Date: Sun, 13 Aug 2000 17:05:17 +0000 Subject: [PATCH] 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. --- Python/compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/compile.c b/Python/compile.c index adefb4fbba..476f1f20bf 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -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; -- 2.49.0