[Python-checkins] r61564 - python/trunk/Python/bltinmodule.c

david.wolever python-checkins at python.org
Tue Mar 18 22:20:26 CET 2008


Author: david.wolever
Date: Tue Mar 18 22:20:25 2008
New Revision: 61564

Modified:
   python/trunk/Python/bltinmodule.c
Log:
Added a warning when -3 is enabled and None is passed to filter as the first argument.

Modified: python/trunk/Python/bltinmodule.c
==============================================================================
--- python/trunk/Python/bltinmodule.c	(original)
+++ python/trunk/Python/bltinmodule.c	Tue Mar 18 22:20:25 2008
@@ -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 {


More information about the Python-checkins mailing list