Kaydet (Commit) 81912d47 authored tarafından Guido van Rossum's avatar Guido van Rossum

Speedup for PyObject_RichCompareBool(): PyObject_RichCompare() almost

always returns a bool, so avoid calling PyObject_IsTrue() in that
case.
üst d5018512
......@@ -998,7 +998,10 @@ PyObject_RichCompareBool(PyObject *v, PyObject *w, int op)
if (res == NULL)
return -1;
ok = PyObject_IsTrue(res);
if (PyBool_Check(res))
ok = (res == Py_True);
else
ok = PyObject_IsTrue(res);
Py_DECREF(res);
return ok;
}
......
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