diff Python/compile.c @ 16677:b955e74955d5 legacy-trunk

Tolerate ill-formed trees in symtable_assign(). Fixes SF bug 132510.
author Jeremy Hylton <jeremy@alum.mit.edu>
date Mon, 19 Feb 2001 15:33:10 +0000
parents 1a5a441772ff
children 17ed61fd5b65
line wrap: on
line diff
--- a/Python/compile.c	Mon Feb 19 14:57:02 2001 +0000
+++ b/Python/compile.c	Mon Feb 19 15:33:10 2001 +0000
@@ -4810,11 +4810,14 @@
 	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);
 	}
 }