From: David Wolever Date: Tue, 18 Mar 2008 21:20:25 +0000 (+0000) Subject: Added a warning when -3 is enabled and None is passed to filter as the first argument. X-Git-Tag: v2.6a2~254 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8e6ec2ff026e2a6cf810094633e530baee21d95a;p=python Added a warning when -3 is enabled and None is passed to filter as the first argument. --- diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 8491ed410a..228bb2d01b 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -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 {