Speed-up construction of empty sets by approx 12-14%.

This commit is contained in:
Raymond Hettinger 2016-03-25 02:29:59 -07:00
parent 734f28461e
commit b72e21b9ab

View File

@ -2015,11 +2015,12 @@ set_init(PySetObject *self, PyObject *args, PyObject *kwds)
if (!PyAnySet_Check(self))
return -1;
if (PySet_Check(self) && !_PyArg_NoKeywords("set()", kwds))
if (kwds != NULL && PySet_Check(self) && !_PyArg_NoKeywords("set()", kwds))
return -1;
if (!PyArg_UnpackTuple(args, Py_TYPE(self)->tp_name, 0, 1, &iterable))
return -1;
set_clear_internal(self);
if (self->fill)
set_clear_internal(self);
self->hash = -1;
if (iterable == NULL)
return 0;