[Python-checkins] cpython: Responsibility for argument checking belongs in set.__init__() rather than

raymond.hettinger python-checkins at python.org
Sat Mar 26 07:11:32 EDT 2016


https://hg.python.org/cpython/rev/e9348b871fdd
changeset:   100760:e9348b871fdd
user:        Raymond Hettinger <python at rcn.com>
date:        Sat Mar 26 04:10:11 2016 -0700
summary:
  Responsibility for argument checking belongs in set.__init__() rather than set.__new__().

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.

files:
  Objects/setobject.c |  3 ---
  1 files changed, 0 insertions(+), 3 deletions(-)


diff --git a/Objects/setobject.c b/Objects/setobject.c
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -1131,9 +1131,6 @@
 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);
 }
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list