mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Added a warning when -3 is enabled and None is passed to filter as the first argument.
This commit is contained in:
parent
30f3680db7
commit
8e6ec2ff02
1 changed files with 7 additions and 0 deletions
|
@ -296,6 +296,13 @@ builtin_filter(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
if (func == (PyObject *)&PyBool_Type || func == Py_None) {
|
||||
if (Py_Py3kWarningFlag &&
|
||||
PyErr_Warn(PyExc_DeprecationWarning,
|
||||
"filter with None as a first argument "
|
||||
"is not supported in 3.x. Use a list "
|
||||
"comprehension instead.") < 0)
|
||||
return NULL;
|
||||
|
||||
ok = PyObject_IsTrue(item);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue