Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 87df80d

Browse files
committed
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.
1 parent dcb45c3 commit 87df80d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Python/compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ static void
10451045
com_listmaker(struct compiling *c, node *n)
10461046
{
10471047
/* listmaker: test ( list_iter | (',' test)* [','] ) */
1048-
if (TYPE(CHILD(n, 1)) == list_iter)
1048+
if (NCH(n) > 1 && TYPE(CHILD(n, 1)) == list_iter)
10491049
com_list_comprehension(c, n);
10501050
else {
10511051
int len = 0;

0 commit comments

Comments
 (0)