diff Python/compile.c @ 9214:c259c3c4d0cc legacy-trunk

Treat def f(a, b=1, c): ... as an error (missing default for c) instead of silently supplying a default of None fore c.
author Guido van Rossum <guido@python.org>
date Fri, 02 Oct 1998 13:41:54 +0000
parents cbf72b2210ae
children 1995cdbe3384
line wrap: on
line diff
--- a/Python/compile.c	Fri Oct 02 03:17:29 1998 +0000
+++ b/Python/compile.c	Fri Oct 02 13:41:54 1998 +0000
@@ -2721,13 +2721,10 @@
 			t = TYPE(CHILD(n, i));
 		}
 		else {
-			/* Treat "(a=1, b)" as "(a=1, b=None)" */
-			if (ndefs) {
-				com_addoparg(c, LOAD_CONST,
-					     com_addconst(c, Py_None));
-				com_push(c, 1);
-				ndefs++;
-			}
+			/* Treat "(a=1, b)" as an error */
+			if (ndefs)
+				com_error(c, PyExc_SyntaxError,
+					  "Missing parameter default value");
 		}
 		if (t != COMMA)
 			break;