From: Raymond Hettinger Date: Thu, 4 Feb 2016 10:46:16 +0000 (-0800) Subject: Add early-out for the common case where kwds is NULL (gives 1.1% speedup). X-Git-Tag: v3.6.0a1~653 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f50215412cdc41b7845a6c0bb040a8f3521a0b84;p=python Add early-out for the common case where kwds is NULL (gives 1.1% speedup). --- diff --git a/Objects/setobject.c b/Objects/setobject.c index 8cb3f364c5..c9834a89e2 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);