diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-07 12:43:59 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-07 12:43:59 (GMT) |
commit | 17e22959a444ee44c9462f3b66610950a8bc5a2b (patch) | |
tree | e6a3629e83b4c84422f0df8181f5e83d9aea37f3 /Objects/weakrefobject.c | |
parent | 1acbf853c8be743c88141501ae879d63eb8ce209 (diff) | |
parent | 21eb48764c618eede0405ef840eadf1b03ff9b00 (diff) | |
download | cpython-17e22959a444ee44c9462f3b66610950a8bc5a2b.zip cpython-17e22959a444ee44c9462f3b66610950a8bc5a2b.tar.gz cpython-17e22959a444ee44c9462f3b66610950a8bc5a2b.tar.bz2 |
Issue #17765: weakref.ref() no longer silently ignores keyword arguments.
Patch by Georg Brandl.
Diffstat (limited to 'Objects/weakrefobject.c')
-rw-r--r-- | Objects/weakrefobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c index f42fe3d..f75b1e8 100644 --- a/Objects/weakrefobject.c +++ b/Objects/weakrefobject.c @@ -268,7 +268,6 @@ static int parse_weakref_init_args(const char *funcname, PyObject *args, PyObject *kwargs, PyObject **obp, PyObject **callbackp) { - /* XXX Should check that kwargs == NULL or is empty. */ return PyArg_UnpackTuple(args, funcname, 1, 2, obp, callbackp); } @@ -331,6 +330,9 @@ weakref___init__(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *tmp; + if (!_PyArg_NoKeywords("ref()", kwargs)) + return -1; + if (parse_weakref_init_args("__init__", args, kwargs, &tmp, &tmp)) return 0; else |