Commit 29d38cd0 authored by Guido van Rossum's avatar Guido van Rossum

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

instead of silently supplying a default of None fore c.
parent b7c61318
...@@ -2721,13 +2721,10 @@ com_argdefs(c, n) ...@@ -2721,13 +2721,10 @@ com_argdefs(c, n)
t = TYPE(CHILD(n, i)); t = TYPE(CHILD(n, i));
} }
else { else {
/* Treat "(a=1, b)" as "(a=1, b=None)" */ /* Treat "(a=1, b)" as an error */
if (ndefs) { if (ndefs)
com_addoparg(c, LOAD_CONST, com_error(c, PyExc_SyntaxError,
com_addconst(c, Py_None)); "Missing parameter default value");
com_push(c, 1);
ndefs++;
}
} }
if (t != COMMA) if (t != COMMA)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment