Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6897355

Browse files
committed
Make filter(bool, ...) as fast as filter(None, ...).
1 parent e5402fb commit 6897355

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Python/bltinmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ builtin_filter(PyObject *self, PyObject *args)
197197
break;
198198
}
199199

200-
if (func == Py_None) {
200+
if (func == (PyObject *)&PyBool_Type || func == Py_None) {
201201
ok = PyObject_IsTrue(item);
202202
}
203203
else {

0 commit comments

Comments
 (0)