diff Python/bltinmodule.c @ 45880:ee0dfccf8cee legacy-trunk

Added a warning when -3 is enabled and None is passed to filter as the first argument.
author David Wolever <david@wolever.net>
date Tue, 18 Mar 2008 21:20:25 +0000
parents 5c0b5cabeec9
children 727f743cf630
line wrap: on
line diff
--- a/Python/bltinmodule.c	Tue Mar 18 21:12:42 2008 +0000
+++ b/Python/bltinmodule.c	Tue Mar 18 21:20:25 2008 +0000
@@ -296,6 +296,13 @@
 		}
 
 		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 {