]> granicus.if.org Git - python/commitdiff
Tolerate ill-formed trees in symtable_assign(). Fixes SF bug 132510.
authorJeremy Hylton <jeremy@alum.mit.edu>
Mon, 19 Feb 2001 15:33:10 +0000 (15:33 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Mon, 19 Feb 2001 15:33:10 +0000 (15:33 +0000)
Python/compile.c

index 7b1740433dd86f74a4b4aa44de667ef819ff4b58..2f98067ac899839209c8b62d0c9b1c6b2754f47d 100644 (file)
@@ -4810,11 +4810,14 @@ symtable_assign(struct symtable *st, node *n, int flag)
        default:
                if (NCH(n) == 0)
                        return;
-               if (NCH(n) != 1) {
-                       DUMP(n);
-                       Py_FatalError("too many children in default case\n");
+               if (NCH(n) == 1) {
+                       n = CHILD(n, 0);
+                       goto loop;
                }
-               n = CHILD(n, 0);
-               goto loop;
+               /* Should only occur for errors like x + 1 = 1,
+                  which will be caught in the next pass. */
+               for (i = 0; i < NCH(n); ++i)
+                       if (TYPE(CHILD(n, i)) >= single_input)
+                               symtable_assign(st, CHILD(n, i), flag);
        }
 }