summaryrefslogtreecommitdiffstats
path: root/Objects/setobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2016-02-04 10:46:16 (GMT)
committerRaymond Hettinger <python@rcn.com>2016-02-04 10:46:16 (GMT)
commitf50215412cdc41b7845a6c0bb040a8f3521a0b84 (patch)
tree786e85108a5683c03e1a253ad4fac0597c571771 /Objects/setobject.c
parentaecef0d2d5962d3f79383e307a7469df783e7357 (diff)
downloadcpython-f50215412cdc41b7845a6c0bb040a8f3521a0b84.zip
cpython-f50215412cdc41b7845a6c0bb040a8f3521a0b84.tar.gz
cpython-f50215412cdc41b7845a6c0bb040a8f3521a0b84.tar.bz2
Add early-out for the common case where kwds is NULL (gives 1.1% speedup).
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 8cb3f36..c9834a8 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -1088,7 +1088,8 @@ frozenset_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *iterable = NULL, *result;
- if (type == &PyFrozenSet_Type && !_PyArg_NoKeywords("frozenset()", kwds))
+ if (kwds != NULL && type == &PyFrozenSet_Type
+ && !_PyArg_NoKeywords("frozenset()", kwds))
return NULL;
if (!PyArg_UnpackTuple(args, type->tp_name, 0, 1, &iterable))
@@ -1130,7 +1131,7 @@ PySet_Fini(void)
static PyObject *
set_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
- if (type == &PySet_Type && !_PyArg_NoKeywords("set()", kwds))
+ if (kwds != NULL && type == &PySet_Type && !_PyArg_NoKeywords("set()", kwds))
return NULL;
return make_new_set(type, NULL);