diff options
author | Guido van Rossum <guido@python.org> | 2002-08-24 06:31:34 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-08-24 06:31:34 (GMT) |
commit | 6248f441ea3ca34ed3306eb8634e6815a42611b4 (patch) | |
tree | 935f51d1466ef9eab41a908c7278ceb040af1692 /Objects | |
parent | 1b9f5d4c1a56a557fda85f796a40bd1c8dac6f70 (diff) | |
download | cpython-6248f441ea3ca34ed3306eb8634e6815a42611b4.zip cpython-6248f441ea3ca34ed3306eb8634e6815a42611b4.tar.gz cpython-6248f441ea3ca34ed3306eb8634e6815a42611b4.tar.bz2 |
Speedup for PyObject_IsTrue(): check for True and False first.
Because all built-in tests return bools now, this is the most common
path!
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/object.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c index 1283294..523a881 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -1497,6 +1497,10 @@ int PyObject_IsTrue(PyObject *v) { int res; + if (v == Py_True) + return 1; + if (v == Py_False) + return 0; if (v == Py_None) return 0; else if (v->ob_type->tp_as_number != NULL && |