Kaydet (Commit) f5021541 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

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

üst aecef0d2
...@@ -1088,7 +1088,8 @@ frozenset_new(PyTypeObject *type, PyObject *args, PyObject *kwds) ...@@ -1088,7 +1088,8 @@ frozenset_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{ {
PyObject *iterable = NULL, *result; PyObject *iterable = NULL, *result;
if (type == &PyFrozenSet_Type && !_PyArg_NoKeywords("frozenset()", kwds)) if (kwds != NULL && type == &PyFrozenSet_Type
&& !_PyArg_NoKeywords("frozenset()", kwds))
return NULL; return NULL;
if (!PyArg_UnpackTuple(args, type->tp_name, 0, 1, &iterable)) if (!PyArg_UnpackTuple(args, type->tp_name, 0, 1, &iterable))
...@@ -1130,7 +1131,7 @@ PySet_Fini(void) ...@@ -1130,7 +1131,7 @@ PySet_Fini(void)
static PyObject * static PyObject *
set_new(PyTypeObject *type, PyObject *args, PyObject *kwds) 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 NULL;
return make_new_set(type, NULL); return make_new_set(type, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment