Add early-out for the common case where kwds is NULL (gives 1.1% speedup).

This commit is contained in:
Raymond Hettinger 2016-02-04 02:46:16 -08:00
parent aecef0d2d5
commit f50215412c
1 changed files with 3 additions and 2 deletions

View File

@ -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);