diff options
author | Raymond Hettinger <python@rcn.com> | 2016-03-25 09:29:59 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2016-03-25 09:29:59 (GMT) |
commit | b72e21b9ab8021b7cbb7e0007d1bf80d533bce15 (patch) | |
tree | 667d472bc5ee4052313c8c0bdbaf7ef25b5dc364 /Objects/setobject.c | |
parent | 734f28461e8939dac484f1f62a0963a281c6dbda (diff) | |
download | cpython-b72e21b9ab8021b7cbb7e0007d1bf80d533bce15.zip cpython-b72e21b9ab8021b7cbb7e0007d1bf80d533bce15.tar.gz cpython-b72e21b9ab8021b7cbb7e0007d1bf80d533bce15.tar.bz2 |
Speed-up construction of empty sets by approx 12-14%.
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r-- | Objects/setobject.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c index c9834a8..8e22b69 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -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; |