summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorDavid Wolever <david@wolever.net>2008-03-18 21:20:25 (GMT)
committerDavid Wolever <david@wolever.net>2008-03-18 21:20:25 (GMT)
commit8e6ec2ff026e2a6cf810094633e530baee21d95a (patch)
treeac5228d11af8b834b87d8dbf2aed5d3f0ab152ef /Python/bltinmodule.c
parent30f3680db7e7f5d34c54f8016799ef9091c5ef0f (diff)
downloadcpython-8e6ec2ff026e2a6cf810094633e530baee21d95a.zip
cpython-8e6ec2ff026e2a6cf810094633e530baee21d95a.tar.gz
cpython-8e6ec2ff026e2a6cf810094633e530baee21d95a.tar.bz2
Added a warning when -3 is enabled and None is passed to filter as the first argument.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 8491ed4..228bb2d 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 {