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

Skip to content

Commit 17820c4

Browse files
committed
Tolerate ill-formed trees in symtable_assign(). Fixes SF bug 132510.
1 parent b6a4425 commit 17820c4

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

Python/compile.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4810,11 +4810,14 @@ symtable_assign(struct symtable *st, node *n, int flag)
48104810
default:
48114811
if (NCH(n) == 0)
48124812
return;
4813-
if (NCH(n) != 1) {
4814-
DUMP(n);
4815-
Py_FatalError("too many children in default case\n");
4813+
if (NCH(n) == 1) {
4814+
n = CHILD(n, 0);
4815+
goto loop;
48164816
}
4817-
n = CHILD(n, 0);
4818-
goto loop;
4817+
/* Should only occur for errors like x + 1 = 1,
4818+
which will be caught in the next pass. */
4819+
for (i = 0; i < NCH(n); ++i)
4820+
if (TYPE(CHILD(n, i)) >= single_input)
4821+
symtable_assign(st, CHILD(n, i), flag);
48194822
}
48204823
}

0 commit comments

Comments
 (0)