summaryrefslogtreecommitdiffstats
path: root/Objects/setobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2016-03-25 09:29:59 (GMT)
committerRaymond Hettinger <python@rcn.com>2016-03-25 09:29:59 (GMT)
commitb72e21b9ab8021b7cbb7e0007d1bf80d533bce15 (patch)
tree667d472bc5ee4052313c8c0bdbaf7ef25b5dc364 /Objects/setobject.c
parent734f28461e8939dac484f1f62a0963a281c6dbda (diff)
downloadcpython-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.c5
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;