diff options
author | Guido van Rossum <guido@python.org> | 1998-10-02 13:41:54 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-10-02 13:41:54 (GMT) |
commit | 29d38cd08861a8fc458a8f842a8a7077786f5154 (patch) | |
tree | 1b61889d3fee48f1e60ef0ed89e9a12a82ca9c60 /Python | |
parent | b7c61318d8e1f5695dc25e2373fa96a227041e20 (diff) | |
download | cpython-29d38cd08861a8fc458a8f842a8a7077786f5154.zip cpython-29d38cd08861a8fc458a8f842a8a7077786f5154.tar.gz cpython-29d38cd08861a8fc458a8f842a8a7077786f5154.tar.bz2 |
Treat def f(a, b=1, c): ... as an error (missing default for c)
instead of silently supplying a default of None fore c.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/Python/compile.c b/Python/compile.c index afe330b..ef88eda 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -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; |