Treat def f(a, b=1, c): ... as an error (missing default for c)

instead of silently supplying a default of None fore c.
This commit is contained in:
Guido van Rossum 1998-10-02 13:41:54 +00:00
parent b7c61318d8
commit 29d38cd088
1 changed files with 4 additions and 7 deletions

View File

@ -2721,13 +2721,10 @@ com_argdefs(c, n)
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;