diff Python/bltinmodule.c @ 45496:002a5ac792b1 legacy-trunk

map(None, ...) is not supported in 3.0.
author Neal Norwitz <nnorwitz@gmail.com>
date Sun, 24 Feb 2008 02:20:25 +0000
parents 4a9522fd75a6
children 18fed14b06b6
line wrap: on
line diff
--- a/Python/bltinmodule.c	Sun Feb 24 00:14:24 2008 +0000
+++ b/Python/bltinmodule.c	Sun Feb 24 02:20:25 2008 +0000
@@ -909,9 +909,15 @@
 	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