summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2000-08-13 17:05:17 +0000
committerThomas Wouters <thomas@python.org>2000-08-13 17:05:17 +0000
commit518f6e9cae3f8839cdeaef78f59cfc877298fc36 (patch)
treecbf7e306b2c84eccde6b1e55981fb80c87761098 /Python/compile.c
parent655b844567337c0fc6b8c700c4e482d056fe549f (diff)
downloadcpython-518f6e9cae3f8839cdeaef78f59cfc877298fc36.tar.gz
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.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c2
1 files changed, 1 insertions, 1 deletions
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;