]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Responsibility for argument checking belongs in set.__init__() rather than set.__new__().
authorRaymond Hettinger <python@rcn.com>
Sat, 26 Mar 2016 11:10:11 +0000 (04:10 -0700)
committerRaymond Hettinger <python@rcn.com>
Sat, 26 Mar 2016 11:10:11 +0000 (04:10 -0700)
See dict.__new__() and list.__new__() for comparison.  Neither of those examine or touch
args or kwds.  That work is done in the __init__() methods.

Objects/setobject.c

index 8e22b690206ee84eb586f8ec3f2327dd85aaa873..34235f867818867344b16526c335d9208d5fe9fd 100644 (file)
@@ -1131,9 +1131,6 @@ PySet_Fini(void)
 static PyObject *
 set_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
-    if (kwds != NULL && type == &PySet_Type && !_PyArg_NoKeywords("set()", kwds))
-        return NULL;
-
     return make_new_set(type, NULL);
 }