Skip to content

Commit b1d9d23

Browse files
author
david.wolever
committed
Added a warning when -3 is enabled and None is passed to filter as the first argument.
git-svn-id: http://svn.python.org/projects/python/trunk@61564 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent f66ad7b commit b1d9d23

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Python/bltinmodule.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,13 @@ builtin_filter(PyObject *self, PyObject *args)
296296
}
297297

298298
if (func == (PyObject *)&PyBool_Type || func == Py_None) {
299+
if (Py_Py3kWarningFlag &&
300+
PyErr_Warn(PyExc_DeprecationWarning,
301+
"filter with None as a first argument "
302+
"is not supported in 3.x. Use a list "
303+
"comprehension instead.") < 0)
304+
return NULL;
305+
299306
ok = PyObject_IsTrue(item);
300307
}
301308
else {

0 commit comments

Comments
 (0)