]> granicus.if.org Git - python/commitdiff
The filter() function does support a None argument in Py3.0.
authorRaymond Hettinger <python@rcn.com>
Wed, 19 Mar 2008 17:58:59 +0000 (17:58 +0000)
committerRaymond Hettinger <python@rcn.com>
Wed, 19 Mar 2008 17:58:59 +0000 (17:58 +0000)
Lib/test/test_py3kwarn.py
Modules/itertoolsmodule.c
Python/bltinmodule.c

index f7a6949b1308cd252e200118a3fad1fdf22f3471..2b54ee1cf4bcba3981e33e92160915877c5ab4dc 100644 (file)
@@ -48,17 +48,6 @@ class TestPy3KWarnings(unittest.TestCase):
         with catch_warning() as w:
             self.assertWarning(cell0 < cell1, w, expected)
 
-    def test_filter(self):
-        from itertools import ifilter
-        from future_builtins import filter
-        expected = 'ifilter with None as a first argument is not supported '\
-                   'in 3.x.  Use a list comprehension instead.'
-
-        with catch_warning() as w:
-            self.assertWarning(ifilter(None, []), w, expected)
-        with catch_warning() as w:
-            self.assertWarning(filter(None, []), w, expected)
-
     def test_code_inequality_comparisons(self):
         expected = 'code inequality comparisons not supported in 3.x.'
         def f(x):
index a369dc9f166d089708f6ec51abafa54cf6066336..8e785bedf566ac623e397b548fcf6bb4539fdd72 100644 (file)
@@ -2552,15 +2552,6 @@ ifilter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
        if (!PyArg_UnpackTuple(args, "ifilter", 2, 2, &func, &seq))
                return NULL;
 
-       if (func == Py_None) {
-               if (Py_Py3kWarningFlag &&
-                   PyErr_Warn(PyExc_DeprecationWarning,
-                              "ifilter with None as a first argument "
-                              "is not supported in 3.x.  Use a list "
-                              "comprehension instead.") < 0)
-                       return NULL;
-       }
-
        /* Get iterator. */
        it = PyObject_GetIter(seq);
        if (it == NULL)
index 0c3d6e2c01f9f542f259e5d4e241449495c96673..3956bb55ef8a11e9291de58ed97b1b0fe5e508c2 100644 (file)
@@ -296,13 +296,6 @@ 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 {