mirror of
https://github.com/python/cpython.git
synced 2024-11-24 18:34:43 +08:00
Speedup for PyObject_IsTrue(): check for True and False first.
Because all built-in tests return bools now, this is the most common path!
This commit is contained in:
parent
1b9f5d4c1a
commit
6248f441ea
@ -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 &&
|
||||
|
Loading…
Reference in New Issue
Block a user