]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
map(None, ...) is not supported in 3.0.
authorNeal Norwitz <nnorwitz@gmail.com>
Sun, 24 Feb 2008 02:20:25 +0000 (02:20 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sun, 24 Feb 2008 02:20:25 +0000 (02:20 +0000)
Python/bltinmodule.c

index 71beeba32141734633498a644606b9ab38d53eb0..648637df5155cdc07f9ebdf5264a983046f040ca 100644 (file)
@@ -909,9 +909,15 @@ builtin_map(PyObject *self, PyObject *args)
        func = PyTuple_GetItem(args, 0);
        n--;
 
-       if (func == Py_None && n == 1) {
-               /* map(None, S) is the same as list(S). */
-               return PySequence_List(PyTuple_GetItem(args, 1));
+       if (func == Py_None) {
+               if (Py_Py3kWarningFlag &&
+                   PyErr_Warn(PyExc_DeprecationWarning, 
+                              "map(None, ...) not supported in 3.x") < 0)
+                       return NULL;
+               if (n == 1) {
+                       /* map(None, S) is the same as list(S). */
+                       return PySequence_List(PyTuple_GetItem(args, 1));
+               }
        }
 
        /* Get space for sequence descriptors.  Must NULL out the iterator