Make Py3k warnings consistent w.r.t. punctuation; also respect the
EOL 80 limit and supply more alternatives in warning messages.
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst
index 0e8901b..d255c16 100644
--- a/Doc/whatsnew/2.6.rst
+++ b/Doc/whatsnew/2.6.rst
@@ -93,7 +93,7 @@
 about features that will be removed in Python 3.0.  You can run code
 with this switch to see how much work will be necessary to port
 code to 3.0.  The value of this switch is available 
-to Python code as the boolean variable ``sys.py3kwarning``,
+to Python code as the boolean variable :data:`sys.py3kwarning`,
 and to C extension code as :cdata:`Py_Py3kWarningFlag`.
 
 Python 3.0 adds several new built-in functions and change the
diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py
index 41ad25b..5766e61 100644
--- a/Lib/test/test_py3kwarn.py
+++ b/Lib/test/test_py3kwarn.py
@@ -11,21 +11,21 @@
 class TestPy3KWarnings(unittest.TestCase):
 
     def test_type_inequality_comparisons(self):
-        expected = 'type inequality comparisons not supported in 3.x.'
+        expected = 'type inequality comparisons not supported in 3.x'
         with catch_warning() as w:
             self.assertWarning(int < str, w, expected)
         with catch_warning() as w:
             self.assertWarning(type < object, w, expected)
 
     def test_object_inequality_comparisons(self):
-        expected = 'comparing unequal types not supported in 3.x.'
+        expected = 'comparing unequal types not supported in 3.x'
         with catch_warning() as w:
             self.assertWarning(str < [], w, expected)
         with catch_warning() as w:
             self.assertWarning(object() < (1, 2), w, expected)
 
     def test_dict_inequality_comparisons(self):
-        expected = 'dict inequality comparisons not supported in 3.x.'
+        expected = 'dict inequality comparisons not supported in 3.x'
         with catch_warning() as w:
             self.assertWarning({} < {2:3}, w, expected)
         with catch_warning() as w:
@@ -36,7 +36,7 @@
             self.assertWarning({2:3} >= {}, w, expected)
 
     def test_cell_inequality_comparisons(self):
-        expected = 'cell comparisons not supported in 3.x.'
+        expected = 'cell comparisons not supported in 3.x'
         def f(x):
             def g():
                 return x
@@ -49,7 +49,7 @@
             self.assertWarning(cell0 < cell1, w, expected)
 
     def test_code_inequality_comparisons(self):
-        expected = 'code inequality comparisons not supported in 3.x.'
+        expected = 'code inequality comparisons not supported in 3.x'
         def f(x):
             pass
         def g(x):
@@ -65,7 +65,7 @@
 
     def test_builtin_function_or_method_comparisons(self):
         expected = ('builtin_function_or_method '
-                    'inequality comparisons not supported in 3.x.')
+                    'inequality comparisons not supported in 3.x')
         func = eval
         meth = {}.get
         with catch_warning() as w:
@@ -81,7 +81,7 @@
         self.assertEqual(str(warning.message), expected_message)
 
     def test_sort_cmp_arg(self):
-        expected = "In 3.x, the cmp argument is no longer supported."
+        expected = "the cmp argument is not supported in 3.x"
         lst = range(5)
         cmp = lambda x,y: -1
 
@@ -95,7 +95,7 @@
             self.assertWarning(sorted(lst, cmp), w, expected)
 
     def test_sys_exc_clear(self):
-        expected = 'sys.exc_clear() not supported in 3.x. Use except clauses.'
+        expected = 'sys.exc_clear() not supported in 3.x; use except clauses'
         with catch_warning() as w:
             self.assertWarning(sys.exc_clear(), w, expected)
 
@@ -119,7 +119,7 @@
                 self.assertWarning(set(), w, expected)
 
     def test_buffer(self):
-        expected = 'buffer will be removed in 3.x'
+        expected = 'buffer() not supported in 3.x; use memoryview()'
         with catch_warning() as w:
             self.assertWarning(buffer('a'), w, expected)
 
diff --git a/Objects/bufferobject.c b/Objects/bufferobject.c
index 0a818d6..fb7e1ef 100644
--- a/Objects/bufferobject.c
+++ b/Objects/bufferobject.c
@@ -231,7 +231,8 @@
 {
 	if (Py_Py3kWarningFlag &&
 	    PyErr_WarnEx(PyExc_DeprecationWarning,
-	    "buffer will be removed in 3.x", 1) < 0)
+			 "buffer() not supported in 3.x; "
+			 "use memoryview()", 1) < 0)
 		return NULL;
 	
 	PyObject *ob;
diff --git a/Objects/cellobject.c b/Objects/cellobject.c
index 2286aaf..b86739e 100644
--- a/Objects/cellobject.c
+++ b/Objects/cellobject.c
@@ -55,8 +55,9 @@
 cell_compare(PyCellObject *a, PyCellObject *b)
 {
 	/* Py3K warning for comparisons  */
-	if (Py_Py3kWarningFlag && PyErr_Warn(PyExc_DeprecationWarning,
-			"cell comparisons not supported in 3.x.") < 0) {
+	if (Py_Py3kWarningFlag &&
+            PyErr_Warn(PyExc_DeprecationWarning,
+		       "cell comparisons not supported in 3.x") < 0) {
 		return -2;
 	}
 
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 57cd2e6..33b4610 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -338,9 +338,12 @@
 	    !PyCode_Check(self) ||
 	    !PyCode_Check(other)) {
 
-		/* Py3K warning if types are not equal and comparison isn't == or !=  */
-		if (Py_Py3kWarningFlag && PyErr_Warn(PyExc_DeprecationWarning,
-				"code inequality comparisons not supported in 3.x.") < 0) {
+		/* Py3K warning if types are not equal and comparison
+                   isn't == or !=  */
+		if (Py_Py3kWarningFlag &&
+		    PyErr_Warn(PyExc_DeprecationWarning,
+			       "code inequality comparisons not supported "
+			       "in 3.x") < 0) {
 			return NULL;
 		}
 
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 1ca2830..b897118 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -1778,8 +1778,10 @@
 	}
 	else {
 		/* Py3K warning if comparison isn't == or !=  */
-		if (Py_Py3kWarningFlag && PyErr_Warn(PyExc_DeprecationWarning,
-				"dict inequality comparisons not supported in 3.x.") < 0) {
+		if (Py_Py3kWarningFlag &&
+                    PyErr_Warn(PyExc_DeprecationWarning,
+			       "dict inequality comparisons not supported "
+			       "in 3.x") < 0) {
 			return NULL;
 		}
 		res = Py_NotImplemented;
@@ -1811,7 +1813,8 @@
 {
 	if (Py_Py3kWarningFlag &&
 	    PyErr_Warn(PyExc_DeprecationWarning, 
-		       "dict.has_key() not supported in 3.x") < 0)
+		       "dict.has_key() not supported in 3.x; "
+		       "use the in operator") < 0)
 		return NULL;
 	return dict_contains(mp, key);
 }
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 7fecb35..ec17bc2 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -190,10 +190,10 @@
 BaseException_getitem(PyBaseExceptionObject *self, Py_ssize_t index)
 {
     if (Py_Py3kWarningFlag) {
-	if (PyErr_Warn(PyExc_DeprecationWarning,
-		       "In 3.x, __getitem__ is not supported for exception "
-		       "classes, use args attribute") == -1)
-	    return NULL;
+        if (PyErr_Warn(PyExc_DeprecationWarning,
+                       "__getitem__ not supported for exception "
+                       "classes in 3.x; use args attribute") == -1)
+            return NULL;
     }
     return PySequence_GetItem(self->args, index);
 }
@@ -203,10 +203,10 @@
 			Py_ssize_t start, Py_ssize_t stop)
 {
     if (Py_Py3kWarningFlag) {
-	if (PyErr_Warn(PyExc_DeprecationWarning,
-		       "In 3.x, __getslice__ is not supported for exception "
-		       "classes, use args attribute") == -1)
-	    return NULL;
+        if (PyErr_Warn(PyExc_DeprecationWarning,
+                       "__getslice__ not supported for exception "
+                       "classes in 3.x; use args attribute") == -1)
+            return NULL;
     }
     return PySequence_GetSlice(self->args, start, stop);
 }
diff --git a/Objects/listobject.c b/Objects/listobject.c
index d4faf0a..81617e4 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -2040,7 +2040,7 @@
 	if (compare != NULL && 
             Py_Py3kWarningFlag &&
 	    PyErr_Warn(PyExc_DeprecationWarning, 
-		       "In 3.x, the cmp argument is no longer supported.") < 0)
+		       "the cmp argument is not supported in 3.x") < 0)
 		return NULL;
 	if (keyfunc == Py_None)
 		keyfunc = NULL;
diff --git a/Objects/methodobject.c b/Objects/methodobject.c
index 16175f9..e641df1 100644
--- a/Objects/methodobject.c
+++ b/Objects/methodobject.c
@@ -235,9 +235,10 @@
 	    !PyCFunction_Check(other))
 	{
 		/* Py3K warning if types are not equal and comparison isn't == or !=  */
-		if (Py_Py3kWarningFlag && PyErr_Warn(PyExc_DeprecationWarning,
-				"builtin_function_or_method "
-				"inequality comparisons not supported in 3.x.") < 0) {
+		if (Py_Py3kWarningFlag &&
+		    PyErr_Warn(PyExc_DeprecationWarning,
+			       "builtin_function_or_method inequality "
+			       "comparisons not supported in 3.x") < 0) {
 			return NULL;
 		}
 
@@ -353,12 +354,10 @@
 {
 	if (name[0] == '_' && name[1] == '_') {
 		if (strcmp(name, "__methods__") == 0) {
-			if (Py_Py3kWarningFlag) {
-				if (PyErr_Warn(PyExc_DeprecationWarning,
-					       "__methods__ not supported "
-					       "in 3.x") < 0)
-					return NULL;
-			}
+			if (Py_Py3kWarningFlag &&
+			    PyErr_Warn(PyExc_DeprecationWarning,
+				       "__methods__ not supported in 3.x") < 0)
+				return NULL;
 			return listmethodchain(chain);
 		}
 		if (strcmp(name, "__doc__") == 0) {
diff --git a/Objects/object.c b/Objects/object.c
index 4a66f4f..e3377f3 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -867,9 +867,10 @@
 
 		/* Py3K warning if types are not equal and comparison isn't == or !=  */
 		if (Py_Py3kWarningFlag &&
-			v->ob_type != w->ob_type && op != Py_EQ && op != Py_NE &&
-			PyErr_Warn(PyExc_DeprecationWarning,
-				"comparing unequal types not supported in 3.x.") < 0) {
+		    v->ob_type != w->ob_type && op != Py_EQ && op != Py_NE &&
+		    PyErr_Warn(PyExc_DeprecationWarning,
+			       "comparing unequal types not supported "
+			       "in 3.x") < 0) {
 			return NULL;
 		}
 
@@ -1691,8 +1692,8 @@
 		    (strcmp(attrname, "__members__") == 0 ||
 		     strcmp(attrname, "__methods__") == 0)) {
 			if (PyErr_Warn(PyExc_DeprecationWarning, 
-				       "__members__ and __methods__ not supported "
-				       "in 3.x") < 0) {
+				       "__members__ and __methods__ not "
+				       "supported in 3.x") < 0) {
 				Py_XDECREF(list);
 				return -1;
 			}
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 82ced39..214e601 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -609,7 +609,8 @@
 	/* Py3K warning if comparison isn't == or !=  */
 	if (Py_Py3kWarningFlag && op != Py_EQ && op != Py_NE &&
 		PyErr_Warn(PyExc_DeprecationWarning,
-			"type inequality comparisons not supported in 3.x.") < 0) {
+			   "type inequality comparisons not supported "
+			   "in 3.x") < 0) {
 		return NULL;
 	}
 
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 6df3005..799db20 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1531,7 +1531,7 @@
 #ifndef PGEN
 		if (Py_Py3kWarningFlag && token == NOTEQUAL && c == '<') {
 			if (PyErr_WarnExplicit(PyExc_DeprecationWarning,
-					       "<> not supported in 3.x",
+					       "<> not supported in 3.x; use !=",
 					       tok->filename, tok->lineno,
 					       NULL, NULL)) {
 				return ERRORTOKEN;
diff --git a/Python/ast.c b/Python/ast.c
index 8a317b8..1fc2324 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -1363,7 +1363,7 @@
         expr_ty expression;
         if (Py_Py3kWarningFlag) {
             if (PyErr_WarnExplicit(PyExc_DeprecationWarning,
-                                   "backquote not supported in 3.x",
+                                   "backquote not supported in 3.x; use repr()",
                                    c->c_filename, LINENO(n),
                                    NULL, NULL)) {
             return NULL;
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 3956bb5..c760dcb 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -166,7 +166,8 @@
 
 	if (Py_Py3kWarningFlag &&
 	    PyErr_Warn(PyExc_DeprecationWarning, 
-		       "apply() not supported in 3.x. Use func(*args, **kwargs).") < 0)
+		       "apply() not supported in 3.x; "
+		       "use func(*args, **kwargs)") < 0)
 		return NULL;
 
 	if (!PyArg_UnpackTuple(args, "apply", 1, 3, &func, &alist, &kwdict))
@@ -225,7 +226,8 @@
 {
 	if (Py_Py3kWarningFlag &&
 	    PyErr_Warn(PyExc_DeprecationWarning, 
-		       "callable() not supported in 3.x. Use hasattr(o, '__call__').") < 0)
+		       "callable() not supported in 3.x; "
+		       "use hasattr(o, '__call__')") < 0)
 		return NULL;
 	return PyBool_FromLong((long)PyCallable_Check(v));
 }
@@ -684,7 +686,7 @@
 
 	if (Py_Py3kWarningFlag &&
 	    PyErr_Warn(PyExc_DeprecationWarning, 
-		       "execfile() not supported in 3.x.  Use exec().") < 0)
+		       "execfile() not supported in 3.x; use exec()") < 0)
 		return NULL;
 
 	if (!PyArg_ParseTuple(args, "s|O!O:execfile",
@@ -912,7 +914,8 @@
 	if (func == Py_None) {
 		if (Py_Py3kWarningFlag &&
 		    PyErr_Warn(PyExc_DeprecationWarning, 
-			       "map(None, ...) not supported in 3.x. Use list(...).") < 0)
+			       "map(None, ...) not supported in 3.x; "
+			       "use list(...)") < 0)
 			return NULL;
 		if (n == 1) {
 			/* map(None, S) is the same as list(S). */
@@ -1934,7 +1937,8 @@
 
 	if (Py_Py3kWarningFlag &&
 	    PyErr_Warn(PyExc_DeprecationWarning, 
-		       "reduce() not supported in 3.x") < 0)
+		       "reduce() not supported in 3.x; "
+		       "use functools.reduce()") < 0)
 		return NULL;
 
 	if (!PyArg_UnpackTuple(args, "reduce", 2, 3, &func, &seq, &result))
@@ -2011,7 +2015,7 @@
 {
 	if (Py_Py3kWarningFlag &&
 	    PyErr_Warn(PyExc_DeprecationWarning, 
-		       "reload() not supported in 3.x") < 0)
+		       "reload() not supported in 3.x; use imp.reload()") < 0)
 		return NULL;
 
 	return PyImport_ReloadModule(v);
diff --git a/Python/ceval.c b/Python/ceval.c
index dc1aa52..7c7116c 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4056,7 +4056,7 @@
      PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS))
 
 #define CANNOT_CATCH_MSG "catching classes that don't inherit from " \
-			 "BaseException is not allowed in 3.x."
+			 "BaseException is not allowed in 3.x"
 
 static PyObject *
 cmp_outcome(int op, register PyObject *v, register PyObject *w)
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 89e7e30..e733cee 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -174,8 +174,8 @@
 
 	if (Py_Py3kWarningFlag &&
 	    PyErr_Warn(PyExc_DeprecationWarning,
-		       "sys.exc_clear() not supported in 3.x. "
-		       "Use except clauses.") < 0)
+		       "sys.exc_clear() not supported in 3.x; "
+		       "use except clauses") < 0)
 		return NULL;
 
 	tstate = PyThreadState_GET();