cpython: ef55fa8c4b82 (original) (raw)
Mercurial > cpython
changeset 101253:ef55fa8c4b82
Issue #17765: weakref.ref() no longer silently ignores keyword arguments. Patch by Georg Brandl. [#17765]
Serhiy Storchaka storchaka@gmail.com | |
---|---|
date | Sat, 07 May 2016 15:43:59 +0300 |
parents | 3ceb54a49387(current diff)ee17a83feabc(diff) |
children | 07b118f9527a |
files | Misc/NEWS Objects/weakrefobject.c |
diffstat | 3 files changed, 10 insertions(+), 1 deletions(-)[+] [-] Lib/test/test_weakref.py 4 Misc/NEWS 3 Objects/weakrefobject.c 4 |
line wrap: on
line diff
--- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -133,6 +133,10 @@ class ReferencesTestCase(TestBase): ref1 = weakref.ref(c, callback) del c
- def test_constructor_kwargs(self):
c = C()[](#l1.8)
self.assertRaises(TypeError, weakref.ref, c, callback=None)[](#l1.9)
+ def test_proxy_ref(self): o = C() o.bar = 1
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -265,6 +265,9 @@ Core and Builtins Library ------- +- Issue #17765: weakref.ref() no longer silently ignores keyword arguments.
- Issue #26873: xmlrpc now raises ResponseError on unsupported type tags instead of silently return incorrect result.
--- 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, PyObjec { PyObject *tmp;
+ if (parse_weakref_init_args("init", args, kwargs, &tmp, &tmp)) return 0; else