[Python-checkins] cpython: Add early-out for the common case where kwds is NULL (gives 1.1% speedup).
raymond.hettinger
python-checkins at python.org
Thu Feb 4 05:46:25 EST 2016
https://hg.python.org/cpython/rev/7fb10bdbe01b
changeset: 100157:7fb10bdbe01b
user: Raymond Hettinger <python at rcn.com>
date: Thu Feb 04 02:46:16 2016 -0800
summary:
Add early-out for the common case where kwds is NULL (gives 1.1% speedup).
files:
Objects/setobject.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Objects/setobject.c b/Objects/setobject.c
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -1088,7 +1088,8 @@
{
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 @@
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);
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list