commit | 81912d4764eb8ccb1b069de46c7f78381f4b19a6 | [log] [tgz] |
---|---|---|
author | Guido van Rossum <guido@python.org> | Sat Aug 24 05:33:28 2002 +0000 |
committer | Guido van Rossum <guido@python.org> | Sat Aug 24 05:33:28 2002 +0000 |
tree | dc3ca526440c32fea11b229f07cc4c3b4a8dc524 | |
parent | d50185127f5cdc7241e5aa80d4d174113bf43b52 [diff] |
Speedup for PyObject_RichCompareBool(): PyObject_RichCompare() almost always returns a bool, so avoid calling PyObject_IsTrue() in that case.
diff --git a/Objects/object.c b/Objects/object.c index 04a7c1f..1283294 100644 --- a/Objects/object.c +++ b/Objects/object.c
@@ -998,7 +998,10 @@ 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; }