Issue #17765: weakref.ref() no longer silently ignores keyword arguments.
Patch by Georg Brandl.
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
index b7f985c..4073d49 100644
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -116,6 +116,10 @@
         ref1 = weakref.ref(c, callback)
         del c
 
+    def test_constructor_kwargs(self):
+        c = C()
+        self.assertRaises(TypeError, weakref.ref, c, callback=None)
+
     def test_proxy_ref(self):
         o = C()
         o.bar = 1
diff --git a/Misc/NEWS b/Misc/NEWS
index 0c2fb0b..cca6266 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -77,6 +77,9 @@
 Library
 -------
 
+- Issue #17765: weakref.ref() no longer silently ignores keyword arguments.
+  Patch by Georg Brandl.
+
 - Issue #26873: xmlrpclib now raises ResponseError on unsupported type tags
   instead of silently return incorrect result.
 
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index e1f4bc4..c8b982f 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -271,7 +271,6 @@
 parse_weakref_init_args(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);
 }
 
@@ -334,6 +333,9 @@
 {
     PyObject *tmp;
 
+    if (!_PyArg_NoKeywords("ref()", kwargs))
+        return -1;
+
     if (parse_weakref_init_args("__init__", args, kwargs, &tmp, &tmp))
         return 0;
     else