Ka-Ping Yee <ping@lfw.org>:
Changes to error messages to increase consistency & clarity.

This (mostly) closes SourceForge patch #101839.
diff --git a/Lib/test/output/test_extcall b/Lib/test/output/test_extcall
index 209ded7..9f4ba43 100644
--- a/Lib/test/output/test_extcall
+++ b/Lib/test/output/test_extcall
@@ -9,9 +9,9 @@
 (1, 2, 3) {'b': 5, 'a': 4}
 (1, 2, 3, 4, 5) {'b': 7, 'a': 6}
 (1, 2, 3, 6, 7) {'y': 5, 'b': 9, 'x': 4, 'a': 8}
-TypeError: not enough arguments; expected 1, got 0
-TypeError: not enough arguments; expected 1, got 0
-TypeError: not enough arguments; expected 1, got 0
+TypeError: not enough arguments to g(); expected 1, got 0
+TypeError: not enough arguments to g(); expected 1, got 0
+TypeError: not enough arguments to g(); expected 1, got 0
 1 () {}
 1 (2,) {}
 1 (2, 3) {}
@@ -20,10 +20,10 @@
 1 () {'d': 4, 'b': 2, 'c': 3, 'a': 1}
 {'b': 2, 'c': 3, 'a': 1}
 {'b': 2, 'c': 3, 'a': 1}
-keyword parameter redefined: x
-keyword parameter redefined: b
+keyword parameter 'x' redefined in call to g()
+keyword parameter 'b' redefined in function call
 keywords must be strings
-unexpected keyword argument: e
+h() got an unexpected keyword argument 'e'
 * argument must be a sequence
 ** argument must be a dictionary
 3 512 1
diff --git a/Modules/dbmmodule.c b/Modules/dbmmodule.c
index 7e16d9b..6847364 100644
--- a/Modules/dbmmodule.c
+++ b/Modules/dbmmodule.c
@@ -140,7 +140,7 @@
 		if ( dbm_store(dp->di_dbm, krec, drec, DBM_REPLACE) < 0 ) {
 			dbm_clearerr(dp->di_dbm);
 			PyErr_SetString(DbmError,
-					"Cannot add item to database");
+					"cannot add item to database");
 			return -1;
 		}
 	}
@@ -255,7 +255,7 @@
 	val.dsize = PyString_GET_SIZE(defvalue);
 	if (dbm_store(dp->di_dbm, key, val, DBM_INSERT) < 0) {
 		dbm_clearerr(dp->di_dbm);
-		PyErr_SetString(DbmError, "Cannot add item to database");
+		PyErr_SetString(DbmError, "cannot add item to database");
 		return NULL;
 	}
 	return defvalue;
@@ -325,7 +325,7 @@
 		iflags = O_RDWR|O_CREAT|O_TRUNC;
 	else {
 		PyErr_SetString(DbmError,
-				"Flags should be one of 'r', 'w', 'c' or 'n'");
+				"arg 2 to open should be 'r', 'w', 'c', or 'n'");
 		return NULL;
 	}
         return newdbmobject(name, iflags, mode);
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c
index 3ffe693..e6e1456 100644
--- a/Modules/parsermodule.c
+++ b/Modules/parsermodule.c
@@ -508,7 +508,7 @@
         if (n != 0)
             res = parser_newastobject(n, type);
         else
-            err_string("Could not parse string.");
+            err_string("could not parse string");
     }
     return (res);
 }
@@ -611,14 +611,14 @@
         else {
             /*  This is a fragment, at best. */
             PyNode_Free(tree);
-            err_string("Parse tree does not use a valid start symbol.");
+            err_string("parse tree does not use a valid start symbol");
         }
     }
     /*  Make sure we throw an exception on all errors.  We should never
      *  get this, but we'd do well to be sure something is done.
      */
     if ((ast == 0) && !PyErr_Occurred())
-        err_string("Unspecified ast error occurred.");
+        err_string("unspecified AST error occurred");
 
     return (ast);
 }
@@ -670,7 +670,7 @@
             PyObject *temp;
 
             if ((len != 2) && (len != 3)) {
-                err_string("Terminal nodes must have 2 or 3 entries.");
+                err_string("terminal nodes must have 2 or 3 entries");
                 return 0;
             }
             temp = PySequence_GetItem(elem, 1);
@@ -678,8 +678,8 @@
                 return 0;
             if (!PyString_Check(temp)) {
                 PyErr_Format(parser_error,
-                             "Second item in terminal node must be a string,"
-                             " found %s.",
+                             "second item in terminal node must be a string,"
+                             " found %s",
                              ((PyTypeObject*)PyObject_Type(temp))->tp_name);
                 Py_DECREF(temp);
                 return 0;
@@ -691,8 +691,8 @@
                         *line_num = PyInt_AS_LONG(o);
                     else {
                         PyErr_Format(parser_error,
-                                     "Third item in terminal node must be an"
-                                     " integer, found %s.",
+                                     "third item in terminal node must be an"
+                                     " integer, found %s",
                                 ((PyTypeObject*)PyObject_Type(temp))->tp_name);
                         Py_DECREF(o);
                         Py_DECREF(temp);
@@ -713,7 +713,7 @@
              *  Throw an exception.
              */
             PyErr_SetObject(parser_error,
-                            Py_BuildValue("os", elem, "Unknown node type."));
+                            Py_BuildValue("os", elem, "unknown node type."));
             Py_XDECREF(elem);
             return (0);
         }
@@ -1566,7 +1566,7 @@
                    && validate_name(CHILD(tree, 2), NULL));
         else {
             res = 0;
-            err_string("Illegal number of children for dotted_as_name.");
+            err_string("illegal number of children for dotted_as_name");
         }
     }
     return res;
@@ -1655,7 +1655,7 @@
                && validate_expr(CHILD(tree, 1)));
 
     if (!res && !PyErr_Occurred())
-        err_string("Illegal exec statement.");
+        err_string("illegal exec statement");
     if (res && (nch > 2))
         res = (validate_name(CHILD(tree, 2), "in")
                && validate_test(CHILD(tree, 3)));
@@ -1682,7 +1682,7 @@
                && validate_test(CHILD(tree, 1)));
 
     if (!res && !PyErr_Occurred())
-        err_string("Illegal assert statement.");
+        err_string("illegal assert statement");
     if (res && (nch > 2))
         res = (validate_comma(CHILD(tree, 2))
                && validate_test(CHILD(tree, 3)));
@@ -1778,7 +1778,7 @@
                 res = ((strcmp(STR(CHILD(tree, pos)), "except") == 0)
                        || (strcmp(STR(CHILD(tree, pos)), "else") == 0));
                 if (!res)
-                    err_string("Illegal trailing triple in try statement.");
+                    err_string("illegal trailing triple in try statement");
             }
             else if (nch == (pos + 6)) {
                 res = (validate_name(CHILD(tree, pos), "except")
@@ -1912,11 +1912,11 @@
                      || (strcmp(STR(tree), "is") == 0));
               if (!res) {
                   PyErr_Format(parser_error,
-                               "Illegal operator: '%s'.", STR(tree));
+                               "illegal operator '%s'", STR(tree));
               }
               break;
           default:
-              err_string("Illegal comparison operator type.");
+              err_string("illegal comparison operator type");
               break;
         }
     }
@@ -1928,7 +1928,7 @@
                    || ((strcmp(STR(CHILD(tree, 0)), "not") == 0)
                        && (strcmp(STR(CHILD(tree, 1)), "in") == 0))));
         if (!res && !PyErr_Occurred())
-            err_string("Unknown comparison operator.");
+            err_string("unknown comparison operator");
     }
     return (res);
 }
@@ -2075,7 +2075,7 @@
         res = validate_trailer(CHILD(tree, pos++));
     if (res && (pos < nch)) {
         if (!is_even(nch - pos)) {
-            err_string("Illegal number of nodes for 'power'.");
+            err_string("illegal number of nodes for 'power'");
             return (0);
         }
         for ( ; res && (pos < (nch - 1)); pos += 2)
@@ -2532,7 +2532,7 @@
             if (res)
                 next = CHILD(tree, 0);
             else if (nch == 1)
-                err_string("Illegal flow_stmt type.");
+                err_string("illegal flow_stmt type");
             break;
             /*
              *  Compound statements.
@@ -2654,7 +2654,7 @@
 
           default:
             /* Hopefully never reached! */
-            err_string("Unrecogniged node type.");
+            err_string("unrecognized node type");
             res = 0;
             break;
         }
@@ -2670,7 +2670,7 @@
     int res = validate_eval_input(tree);
 
     if (!res && !PyErr_Occurred())
-        err_string("Could not validate expression tuple.");
+        err_string("could not validate expression tuple");
 
     return (res);
 }
@@ -2698,7 +2698,7 @@
      *  this, we have some debugging to do.
      */
     if (!res && !PyErr_Occurred())
-        err_string("VALIDATION FAILURE: report this to the maintainer!.");
+        err_string("VALIDATION FAILURE: report this to the maintainer!");
 
     return (res);
 }
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 8544f6a..a2251b1 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1226,7 +1226,7 @@
 	}
 	else if (!PyArg_Parse(arg, "(ll)", &atime, &mtime)) {
 		PyErr_SetString(PyExc_TypeError,
-			      "Second argument must be a 2-tuple of numbers.");
+				"utime() arg 2 must be a tuple (atime, mtime)");
 		return NULL;
 	}
 	else {
@@ -1294,12 +1294,12 @@
 		getitem = PyTuple_GetItem;
 	}
 	else {
-		PyErr_SetString(PyExc_TypeError, "argv must be tuple or list");
+		PyErr_SetString(PyExc_TypeError, "execv() arg 2 must be a tuple or list");
 		return NULL;
 	}
 
 	if (argc == 0) {
-		PyErr_SetString(PyExc_ValueError, "empty argument list");
+		PyErr_SetString(PyExc_ValueError, "execv() arg 2 must not be empty");
 		return NULL;
 	}
 
@@ -1310,7 +1310,7 @@
 		if (!PyArg_Parse((*getitem)(argv, i), "s", &argvlist[i])) {
 			PyMem_DEL(argvlist);
 			PyErr_SetString(PyExc_TypeError, 
-					"all arguments must be strings");
+					"execv() arg 2 must contain only strings");
 			return NULL;
 			
 		}
@@ -1364,17 +1364,17 @@
 		getitem = PyTuple_GetItem;
 	}
 	else {
-		PyErr_SetString(PyExc_TypeError, "argv must be tuple or list");
+		PyErr_SetString(PyExc_TypeError, "execve() arg 2 must be a tuple or list");
 		return NULL;
 	}
 	if (!PyMapping_Check(env)) {
-		PyErr_SetString(PyExc_TypeError, "env must be mapping object");
+		PyErr_SetString(PyExc_TypeError, "execve() arg 3 must be a mapping object");
 		return NULL;
 	}
 
 	if (argc == 0) {
 		PyErr_SetString(PyExc_ValueError, 
-				"empty argument list");
+				"execve() arg 2 must not be empty");
 		return NULL;
 	}
 
@@ -1385,7 +1385,7 @@
 	}
 	for (i = 0; i < argc; i++) {
 		if (!PyArg_Parse((*getitem)(argv, i),
-				 "s;argv must be list of strings",
+				 "s;execve() arg 2 must contain only strings",
 				 &argvlist[i]))
 		{
 			goto fail_1;
@@ -1413,8 +1413,8 @@
 		if (!key || !val)
 			goto fail_2;
 		
-		if (!PyArg_Parse(key, "s;non-string key in env", &k) ||
-		    !PyArg_Parse(val, "s;non-string value in env", &v))
+		if (!PyArg_Parse(key, "s;execve() arg 3 contains a non-string key", &k) ||
+		    !PyArg_Parse(val, "s;execve() arg 3 contains a non-string value", &v))
 		{
 			goto fail_2;
 		}
@@ -1493,7 +1493,7 @@
 		getitem = PyTuple_GetItem;
 	}
 	else {
-		PyErr_SetString(PyExc_TypeError, "argv must be tuple or list");
+		PyErr_SetString(PyExc_TypeError, "spawmv() arg 2 must be a tuple or list");
 		return NULL;
 	}
 
@@ -1504,7 +1504,7 @@
 		if (!PyArg_Parse((*getitem)(argv, i), "s", &argvlist[i])) {
 			PyMem_DEL(argvlist);
 			PyErr_SetString(PyExc_TypeError, 
-					"all arguments must be strings");
+					"spawnv() arg 2 must contain only strings");
 			return NULL;
 		}
 	}
@@ -1563,11 +1563,11 @@
 		getitem = PyTuple_GetItem;
 	}
 	else {
-		PyErr_SetString(PyExc_TypeError, "argv must be tuple or list");
+		PyErr_SetString(PyExc_TypeError, "spawnve() arg 2 must be a tuple or list");
 		return NULL;
 	}
 	if (!PyMapping_Check(env)) {
-		PyErr_SetString(PyExc_TypeError, "env must be mapping object");
+		PyErr_SetString(PyExc_TypeError, "spawnve() arg 3 must be a mapping object");
 		return NULL;
 	}
 
@@ -1578,7 +1578,7 @@
 	}
 	for (i = 0; i < argc; i++) {
 		if (!PyArg_Parse((*getitem)(argv, i),
-				 "s;argv must be list of strings",
+				 "s;spawnve() arg 2 must contain only strings",
 				 &argvlist[i]))
 		{
 			goto fail_1;
@@ -1606,8 +1606,8 @@
 		if (!key || !val)
 			goto fail_2;
 		
-		if (!PyArg_Parse(key, "s;non-string key in env", &k) ||
-		    !PyArg_Parse(val, "s;non-string value in env", &v))
+		if (!PyArg_Parse(key, "s;spawnve() arg 3 contains a non-string key", &k) ||
+		    !PyArg_Parse(val, "s;spawnve() arg 3 contains a non-string value", &v))
 		{
 			goto fail_2;
 		}
@@ -2150,13 +2150,13 @@
 	if (*mode == 'r')
 		tm = _O_RDONLY;
 	else if (*mode != 'w') {
-		PyErr_SetString(PyExc_ValueError, "mode must be 'r' or 'w'");
+		PyErr_SetString(PyExc_ValueError, "popen() arg 2 must be 'r' or 'w'");
 		return NULL;
 	} else
 		tm = _O_WRONLY;
 	 
 	if (bufsize != -1) {
-		PyErr_SetString(PyExc_ValueError, "bufsize must be -1");
+		PyErr_SetString(PyExc_ValueError, "popen() arg 3 must be -1");
 		return NULL;
 	}
 
@@ -2191,13 +2191,13 @@
 	if (*mode == 't')
 		tm = _O_TEXT;
 	else if (*mode != 'b') {
-		PyErr_SetString(PyExc_ValueError, "mode must be 't' or 'b'");
+		PyErr_SetString(PyExc_ValueError, "popen2() arg 2 must be 't' or 'b'");
 		return NULL;
 	} else
 		tm = _O_BINARY;
   
 	if (bufsize != -1) {
-		PyErr_SetString(PyExc_ValueError, "bufsize must be -1");
+		PyErr_SetString(PyExc_ValueError, "popen2() arg 3 must be -1");
 		return NULL;
 	}
 
@@ -2228,13 +2228,13 @@
 	if (*mode == 't')
 		tm = _O_TEXT;
 	else if (*mode != 'b') {
-		PyErr_SetString(PyExc_ValueError, "mode must be 't' or 'b'");
+		PyErr_SetString(PyExc_ValueError, "popen3() arg 2 must be 't' or 'b'");
 		return NULL;
 	} else
 		tm = _O_BINARY;
   
 	if (bufsize != -1) {
-		PyErr_SetString(PyExc_ValueError, "bufsize must be -1");
+		PyErr_SetString(PyExc_ValueError, "popen3() arg 3 must be -1");
 		return NULL;
 	}
 
@@ -2265,13 +2265,13 @@
 	if (*mode == 't')
 		tm = _O_TEXT;
 	else if (*mode != 'b') {
-		PyErr_SetString(PyExc_ValueError, "mode must be 't' or 'b'");
+		PyErr_SetString(PyExc_ValueError, "popen4() arg 2 must be 't' or 'b'");
 		return NULL;
 	} else
 		tm = _O_BINARY;
 
 	if (bufsize != -1) {
-		PyErr_SetString(PyExc_ValueError, "bufsize must be -1");
+		PyErr_SetString(PyExc_ValueError, "popen4() arg 3 must be -1");
 		return NULL;
 	}
 
@@ -2727,13 +2727,13 @@
 		 * an exception.  Just die.
 		 */
 		 Py_FatalError("unable to allocate interpreter state "
-		 	       "when closing popen object.");
+		 	       "when closing popen object");
 		 return -1;  /* unreachable */
 	}
 	pThreadState = PyThreadState_New(pInterpreterState);
 	if (!pThreadState) {
 		 Py_FatalError("unable to allocate thread state "
-		 	       "when closing popen object.");
+		 	       "when closing popen object");
 		 return -1;  /* unreachable */
 	}
 	/* Grab the global lock.  Note that this will deadlock if the
@@ -3761,7 +3761,7 @@
 	message = strerror(code);
 	if (message == NULL) {
 		PyErr_SetString(PyExc_ValueError,
-				"strerror code out of range");
+				"strerror() argument out of range");
 		return NULL;
 	}
 	return PyString_FromString(message);
diff --git a/Objects/classobject.c b/Objects/classobject.c
index c362b80..1c9cd7e 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -173,7 +173,9 @@
 	}
 	v = class_lookup(op, name, &class);
 	if (v == NULL) {
-		PyErr_SetObject(PyExc_AttributeError, name);
+		PyErr_Format(PyExc_AttributeError,
+			     "class %.50s has no attribute '%.400s'",
+			     PyString_AS_STRING(op->cl_name), sname);
 		return NULL;
 	}
 	Py_INCREF(v);
@@ -285,8 +287,9 @@
 	if (v == NULL) {
 		int rv = PyDict_DelItem(op->cl_dict, name);
 		if (rv < 0)
-			PyErr_SetString(PyExc_AttributeError,
-				   "delete non-existing class attribute");
+			PyErr_Format(PyExc_AttributeError,
+				     "class %.50s has no attribute '%.400s'",
+				     PyString_AS_STRING(op->cl_name), sname);
 		return rv;
 	}
 	else
@@ -578,7 +581,8 @@
 	}
 	v = instance_getattr2(inst, name);
 	if (v == NULL) {
-		PyErr_Format(PyExc_AttributeError,"'%.50s' instance has no attribute '%.400s'",
+		PyErr_Format(PyExc_AttributeError,
+			     "%.50s instance has no attribute '%.400s'",
 			     PyString_AS_STRING(inst->in_class->cl_name), sname);
 	}
 	return v;
@@ -642,8 +646,10 @@
 	if (v == NULL) {
 		int rv = PyDict_DelItem(inst->in_dict, name);
 		if (rv < 0)
-			PyErr_SetString(PyExc_AttributeError,
-				   "delete non-existing instance attribute");
+			PyErr_Format(PyExc_AttributeError,
+				     "%.50s instance has no attribute '%.400s'",
+				     PyString_AS_STRING(inst->in_class->cl_name),
+				     PyString_AS_STRING(name));
 		return rv;
 	}
 	else
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index b8b47f8..94c5bb0 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -833,7 +833,7 @@
 			buffersize *= 2;
 			if (buffersize > INT_MAX) {
 				PyErr_SetString(PyExc_OverflowError,
-					"line is too long for a Python string");
+					"line is longer than a Python string can hold");
 				goto error;
 			}
 			if (big_buffer == NULL) {
@@ -938,7 +938,7 @@
 		return err_closed();
 	if (args == NULL || !PySequence_Check(args)) {
 		PyErr_SetString(PyExc_TypeError,
-			   "writelines() requires sequence of strings");
+			   "writelines() argument must be a sequence of strings");
 		return NULL;
 	}
 	islist = PyList_Check(args);
@@ -1001,7 +1001,7 @@
 							   &buffer,
 							   &len))) {
 					PyErr_SetString(PyExc_TypeError,
-				"writelines() requires sequences of strings");
+				"writelines() argument must be a sequence of strings");
 					goto error;
 				}
 				line = PyString_FromStringAndSize(buffer,
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index d776147..b58c7fd 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -466,7 +466,7 @@
 	if (iv == 0.0) {
 		if (iw < 0.0) {
 			PyErr_SetString(PyExc_ZeroDivisionError,
-				   "0.0 to a negative power");
+					"0.0 cannot be raised to a negative power");
 			return NULL;
 		}
 		return PyFloat_FromDouble(0.0);
@@ -486,7 +486,7 @@
 		/* Sort out special cases here instead of relying on pow() */
 		if (iv < 0.0) {
 			PyErr_SetString(PyExc_ValueError,
-				   "negative number to a float power");
+					"negative number cannot be raised to a fractional power");
 			return NULL;
 		}
 		errno = 0;
diff --git a/Objects/intobject.c b/Objects/intobject.c
index c9d1f6a..18acf6b 100644
--- a/Objects/intobject.c
+++ b/Objects/intobject.c
@@ -171,7 +171,7 @@
 	char buffer[256]; /* For errors */
 
 	if ((base != 0 && base < 2) || base > 36) {
-		PyErr_SetString(PyExc_ValueError, "invalid base for int()");
+		PyErr_SetString(PyExc_ValueError, "int() base must be >= 2 and <= 36");
 		return NULL;
 	}
 
@@ -417,7 +417,7 @@
 	
 	if (yi == 0) {
 		PyErr_SetString(PyExc_ZeroDivisionError,
-				"integer division or modulo");
+				"integer division or modulo by zero");
 		return -1;
 	}
 	if (yi < 0) {
@@ -485,17 +485,17 @@
 	if (iw < 0) {
 		if (iv)
 			PyErr_SetString(PyExc_ValueError,
-					"integer to a negative power");
+					"cannot raise integer to a negative power");
 		else
 			PyErr_SetString(PyExc_ZeroDivisionError,
-					"0 to a negative power");
+					"cannot raise 0 to a negative power");
 		return NULL;
 	}
  	if ((PyObject *)z != Py_None) {
 		iz = z->ob_ival;
 		if (iz == 0) {
 			PyErr_SetString(PyExc_ValueError,
-					"pow(x, y, z) with z==0");
+					"pow() arg 3 cannot be 0");
 			return NULL;
 		}
 	}
diff --git a/Objects/longobject.c b/Objects/longobject.c
index bfb431f..615d1d8 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -173,7 +173,7 @@
 
  overflow:
 	PyErr_SetString(PyExc_OverflowError,
-			"long int too long to convert");
+			"long int too large to convert");
 	return -1;
 }
 
@@ -204,7 +204,7 @@
 		x = (x << SHIFT) + v->ob_digit[i];
 		if ((x >> SHIFT) != prev) {
 			PyErr_SetString(PyExc_OverflowError,
-				"long int too long to convert");
+				"long int too large to convert");
 			return (unsigned long) -1;
 		}
 	}
@@ -653,7 +653,7 @@
 	
 	if ((base != 0 && base < 2) || base > 36) {
 		PyErr_SetString(PyExc_ValueError,
-				"invalid base for long literal");
+				"long() arg 2 must be >= 2 and <= 36");
 		return NULL;
 	}
 	while (*str != '\0' && isspace(Py_CHARMASK(*str)))
@@ -751,7 +751,7 @@
 	
 	if (size_b == 0) {
 		PyErr_SetString(PyExc_ZeroDivisionError,
-				"long division or modulo");
+				"long division or modulo by zero");
 		return -1;
 	}
 	if (size_a < size_b ||
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index c655e95..4267896 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -163,13 +163,22 @@
 module_getattr(PyModuleObject *m, char *name)
 {
 	PyObject *res;
+	char* modname;
 	if (strcmp(name, "__dict__") == 0) {
 		Py_INCREF(m->md_dict);
 		return m->md_dict;
 	}
 	res = PyDict_GetItemString(m->md_dict, name);
-	if (res == NULL)
-		PyErr_SetString(PyExc_AttributeError, name);
+	if (res == NULL) {
+		modname = PyModule_GetName((PyObject *)m);
+		if (modname == NULL) {
+			PyErr_Clear();
+			modname = "?";
+		}
+		PyErr_Format(PyExc_AttributeError,
+			     "'%.50s' module has no attribute '%.400s'",
+			     modname, name);
+	}
 	else
 		Py_INCREF(res);
 	return res;
@@ -178,6 +187,7 @@
 static int
 module_setattr(PyModuleObject *m, char *name, PyObject *v)
 {
+	char* modname;
 	if (name[0] == '_' && strcmp(name, "__dict__") == 0) {
 		PyErr_SetString(PyExc_TypeError,
 				"read-only special attribute");
@@ -185,9 +195,16 @@
 	}
 	if (v == NULL) {
 		int rv = PyDict_DelItemString(m->md_dict, name);
-		if (rv < 0)
-			PyErr_SetString(PyExc_AttributeError,
-				   "delete non-existing module attribute");
+		if (rv < 0) {
+			modname = PyModule_GetName((PyObject *)m);
+			if (modname == NULL) {
+				PyErr_Clear();
+				modname = "?";
+			}
+			PyErr_Format(PyExc_AttributeError,
+				     "'%.50s' module has no attribute '%.400s'",
+				     modname, name);
+		}
 		return rv;
 	}
 	else
diff --git a/Objects/object.c b/Objects/object.c
index 9b7c551..6f22c53 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -175,7 +175,7 @@
 		return -1;
 #ifdef USE_STACKCHECK
 	if (PyOS_CheckStack()) {
-		PyErr_SetString(PyExc_MemoryError, "Stack overflow");
+		PyErr_SetString(PyExc_MemoryError, "stack overflow");
 		return -1;
 	}
 #endif
@@ -227,7 +227,7 @@
 		return NULL;
 #ifdef USE_STACKCHECK
 	if (PyOS_CheckStack()) {
-		PyErr_SetString(PyExc_MemoryError, "Stack overflow");
+		PyErr_SetString(PyExc_MemoryError, "stack overflow");
 		return NULL;
 	}
 #endif
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index dbade8c..757c1c4 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -2460,7 +2460,7 @@
 	   always given), therefore increase by one to 10+prec. */
 	if (buflen <= (size_t)10 + (size_t)prec) {
 		PyErr_SetString(PyExc_OverflowError,
-			"formatted float is too long (precision too long?)");
+			"formatted float is too long (precision too large?)");
 		return -1;
 	}
 	sprintf(buf, fmt, x);
@@ -2626,7 +2626,7 @@
 	   worst case buf = '0x' + [0-9]*prec, where prec >= 11 */
 	if (buflen <= 13 || buflen <= (size_t)2 + (size_t)prec) {
 		PyErr_SetString(PyExc_OverflowError,
-			"formatted integer is too long (precision too long?)");
+			"formatted integer is too long (precision too large?)");
 		return -1;
 	}
 	sprintf(buf, fmt, x);
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 4ca1310..7c8cf18 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -71,7 +71,7 @@
 		if (!PyTuple_Check(alist)) {
 			if (!PySequence_Check(alist)) {
 				PyErr_SetString(PyExc_TypeError,
-				    "apply() 2nd argument must be a sequence");
+				    "apply() arg 2 must be a sequence");
 				return NULL;
 			}
 			t = PySequence_Tuple(alist);
@@ -82,7 +82,7 @@
 	}
 	if (kwdict != NULL && !PyDict_Check(kwdict)) {
 		PyErr_SetString(PyExc_TypeError,
-			   "apply() 3rd argument must be dictionary");
+			   "apply() arg 3 must be a dictionary");
 		goto finally;
 	}
 	retval = PyEval_CallObjectWithKeywords(func, alist, kwdict);
@@ -181,7 +181,7 @@
 	sqf = seq->ob_type->tp_as_sequence;
 	if (sqf == NULL || sqf->sq_length == NULL || sqf->sq_item == NULL) {
 		PyErr_SetString(PyExc_TypeError,
-			   "argument 2 to filter() must be a sequence type");
+			   "filter() arg 2 must be a sequence");
 		goto Fail_2;
 	}
 
@@ -368,7 +368,7 @@
 		start = Py_single_input;
 	else {
 		PyErr_SetString(PyExc_ValueError,
-		   "compile() mode must be 'exec' or 'eval' or 'single'");
+		   "compile() arg 3 must be 'exec' or 'eval' or 'single'");
 		return NULL;
 	}
 	return Py_CompileString(str, filename, start);
@@ -421,7 +421,7 @@
 	}
 	else if (PyObject_AsCharBuffer(v, &s, &len)) {
 		PyErr_SetString(PyExc_TypeError,
-				"complex() needs a string first argument");
+				"complex() arg is not a string");
 		return NULL;
 	}
 
@@ -431,7 +431,7 @@
 		s++;
 	if (s[0] == '\0') {
 		PyErr_SetString(PyExc_ValueError,
-				"empty string for complex()");
+				"complex() arg is an empty string");
 		return NULL;
 	}
 
@@ -445,7 +445,7 @@
 			if (s-start != len) {
 				PyErr_SetString(
 					PyExc_ValueError,
-					"null byte in argument for complex()");
+					"complex() arg contains a null byte");
 				return NULL;
 			}
 			if(!done) sw_error=1;
@@ -531,7 +531,7 @@
 
 	if (sw_error) {
 		PyErr_SetString(PyExc_ValueError,
-				"malformed string for complex()");
+				"complex() arg is a malformed string");
 		return NULL;
 	}
 
@@ -557,7 +557,7 @@
 	     ((nbi = i->ob_type->tp_as_number) == NULL ||
 	      nbi->nb_float == NULL))) {
 		PyErr_SetString(PyExc_TypeError,
-			   "complex() argument can't be converted to complex");
+			   "complex() arg can't be converted to complex");
 		return NULL;
 	}
 	/* XXX Hack to support classes with __complex__ method */
@@ -748,7 +748,7 @@
 	if (!PyString_Check(cmd) &&
 	    !PyUnicode_Check(cmd)) {
 		PyErr_SetString(PyExc_TypeError,
-			   "eval() argument 1 must be string or code object");
+			   "eval() arg 1 must be a string or code object");
 		return NULL;
 	}
 	if (PyString_AsStringAndSize(cmd, &str, NULL))
@@ -1224,7 +1224,7 @@
 					 base);
 	else {
 		PyErr_SetString(PyExc_TypeError,
-				"can't convert non-string with explicit base");
+				"int() can't convert non-string with explicit base");
 		return NULL;
 	}
 }
@@ -1257,7 +1257,7 @@
 					  base);
 	else {
 		PyErr_SetString(PyExc_TypeError,
-				"can't convert non-string with explicit base");
+				"long() can't convert non-string with explicit base");
 		return NULL;
 	}
 }
@@ -1384,7 +1384,7 @@
 	sq = v->ob_type->tp_as_sequence;
 	if (sq == NULL || sq->sq_item == NULL) {
 		PyErr_SetString(PyExc_TypeError,
-				"min() or max() of non-sequence");
+				"min() or max() arg must be a sequence");
 		return NULL;
 	}
 	w = NULL;
@@ -1417,7 +1417,7 @@
 	}
 	if (w == NULL)
 		PyErr_SetString(PyExc_ValueError,
-				"min() or max() of empty sequence");
+				"min() or max() arg is an empty sequence");
 	return w;
 }
 
@@ -1520,7 +1520,7 @@
 			ord = (long)*PyUnicode_AS_UNICODE(obj);
 	} else {
 		PyErr_Format(PyExc_TypeError,
-			     "expected string or Unicode character, " \
+			     "ord() expected string or Unicode character, " \
 			     "%.200s found", obj->ob_type->tp_name);
 		return NULL;
 	}
@@ -1528,7 +1528,7 @@
 		return PyInt_FromLong(ord);
 
 	PyErr_Format(PyExc_TypeError, 
-		     "expected a character, length-%d string found",
+		     "ord() expected a character, length-%d string found",
 		     size);
 	return NULL;
 }
@@ -1607,7 +1607,7 @@
 			return NULL;
 	}
 	if (istep == 0) {
-		PyErr_SetString(PyExc_ValueError, "zero step for range()");
+		PyErr_SetString(PyExc_ValueError, "range() arg 3 must not be zero");
 		return NULL;
 	}
 	if (istep > 0)
@@ -1617,7 +1617,7 @@
 	n = (int)bign;
 	if (bign < 0 || (long)n != bign) {
 		PyErr_SetString(PyExc_OverflowError,
-				"range() has too many items");
+				"range() result has too many items");
 		return NULL;
 	}
 	v = PyList_New(n);
@@ -1664,7 +1664,7 @@
 			return NULL;
 	}
 	if (istep == 0) {
-		PyErr_SetString(PyExc_ValueError, "zero step for xrange()");
+		PyErr_SetString(PyExc_ValueError, "xrange() arg 3 must not be zero");
 		return NULL;
 	}
 	if (istep > 0)
@@ -1673,7 +1673,7 @@
 		n = get_len_of_range(ihigh, ilow, -istep);
 	if (n < 0) {
 		PyErr_SetString(PyExc_OverflowError,
-				"xrange() has more than sys.maxint items");
+				"xrange() result has too many items");
 		return NULL;
 	}
 	return PyRange_New(ilow, n, istep, 1);
@@ -1779,7 +1779,7 @@
 	sqf = seq->ob_type->tp_as_sequence;
 	if (sqf == NULL || sqf->sq_item == NULL) {
 		PyErr_SetString(PyExc_TypeError,
-		    "2nd argument to reduce() must be a sequence object");
+		    "reduce() arg 2 must be a sequence");
 		return NULL;
 	}
 
@@ -1817,7 +1817,7 @@
 
 	if (result == NULL)
 		PyErr_SetString(PyExc_TypeError,
-			   "reduce of empty sequence with no initial value");
+			   "reduce() of empty sequence with no initial value");
 
 	return result;
 
@@ -2073,7 +2073,7 @@
 		if (icls != NULL) {
 			retval = abstract_issubclass(
 				icls, cls,
-				"second argument must be a class", 
+				"isinstance() arg 2 must be a class", 
 				1);
 			Py_DECREF(icls);
 			if (retval < 0)
@@ -2081,13 +2081,13 @@
 		}
 		else {
 			PyErr_SetString(PyExc_TypeError,
-					"second argument must be a class");
+					"isinstance() arg 2 must be a class");
 			return NULL;
 		}
 	}
         else {
 		PyErr_SetString(PyExc_TypeError,
-				"second argument must be a class");
+				"isinstance() arg 2 must be a class");
 		return NULL;
 	}
 	return PyInt_FromLong(retval);
@@ -2140,7 +2140,7 @@
 
 	if (itemsize < 1) {
 		PyErr_SetString(PyExc_TypeError,
-				"at least one sequence is required");
+				"zip() requires at least one sequence");
 		return NULL;
 	}
 	/* args must be a tuple */
diff --git a/Python/ceval.c b/Python/ceval.c
index a1c8190..df057b7 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -61,9 +61,9 @@
 static void format_exc_check_arg(PyObject *, char *, PyObject *);
 
 #define NAME_ERROR_MSG \
-	"There is no variable named '%s'"
+	"name '%.200s' is not defined"
 #define UNBOUNDLOCAL_ERROR_MSG \
-	"Local variable '%.200s' referenced before assignment"
+	"local variable '%.200s' referenced before assignment"
 
 /* Dynamic execution profile */
 #ifdef DYNAMIC_EXECUTION_PROFILE
@@ -439,8 +439,10 @@
 		if (argcount > co->co_argcount) {
 			if (!(co->co_flags & CO_VARARGS)) {
 				PyErr_Format(PyExc_TypeError,
-				"too many arguments; expected %d, got %d",
-					     co->co_argcount, argcount);
+				    "too many arguments to %s(); "
+				    "expected %d, got %d",
+				    PyString_AsString(co->co_name),
+				    co->co_argcount, argcount);
 				goto fail;
 			}
 			n = co->co_argcount;
@@ -483,7 +485,9 @@
 			if (j >= co->co_argcount) {
 				if (kwdict == NULL) {
 					PyErr_Format(PyExc_TypeError,
-					 "unexpected keyword argument: %.400s",
+					    "%.200s() got an unexpected "
+					    "keyword argument '%.400s'",
+					    PyString_AsString(co->co_name),
 					    PyString_AsString(keyword));
 					goto fail;
 				}
@@ -492,8 +496,10 @@
 			else {
 				if (GETLOCAL(j) != NULL) {
 					PyErr_Format(PyExc_TypeError, 
-				     "keyword parameter redefined: %.400s",
-					     PyString_AsString(keyword));
+					     "keyword parameter '%.400s' "
+					     "redefined in call to %.200s()",
+					     PyString_AsString(keyword),
+					     PyString_AsString(co->co_name));
 					goto fail;
 				}
 				Py_INCREF(value);
@@ -505,8 +511,10 @@
 			for (i = argcount; i < m; i++) {
 				if (GETLOCAL(i) == NULL) {
 					PyErr_Format(PyExc_TypeError,
-				"not enough arguments; expected %d, got %d",
-						     m, i);
+					    "not enough arguments to "
+					    "%.200s(); expected %d, got %d",
+					    PyString_AsString(co->co_name),
+					    m, i);
 					goto fail;
 				}
 			}
@@ -525,8 +533,9 @@
 	}
 	else {
 		if (argcount > 0 || kwcount > 0) {
-			PyErr_SetString(PyExc_TypeError,
-					"no arguments expected");
+			PyErr_Format(PyExc_TypeError,
+				     "%.200s() expected no arguments",
+				     PyString_AsString(co->co_name));
 			goto fail;
 		}
 	}
@@ -565,7 +574,7 @@
 	if (++tstate->recursion_depth > recursion_limit) {
 		--tstate->recursion_depth;
 		PyErr_SetString(PyExc_RuntimeError,
-				"Maximum recursion depth exceeded");
+				"maximum recursion depth exceeded");
 		tstate->frame = f->f_back;
 		Py_DECREF(f);
 		return NULL;
@@ -1825,7 +1834,7 @@
                                   /* Handy-dandy */ ;
 			    else {
 				PyErr_SetString(PyExc_TypeError,
-	    "unbound method must be called with class instance 1st argument");
+	    "unbound method must be called with instance as first argument");
 				x = NULL;
 				break;
 			    }
@@ -1908,9 +1917,10 @@
 				PyObject *key = POP();
 				if (PyDict_GetItem(kwdict, key) != NULL) {
 				    err = 1;
-				    PyErr_Format(PyExc_TypeError,
-					"keyword parameter redefined: %.400s",
-						 PyString_AsString(key));
+				    PyErr_Format(PyExc_TypeError, 
+					 "keyword parameter '%.400s' "
+					 "redefined in function call",
+					 PyString_AsString(key));
 				    Py_DECREF(key);
 				    Py_DECREF(value);
 				    goto extcall_fail;
@@ -2308,7 +2318,7 @@
 	}
 	else if (tb != NULL && !PyTraceBack_Check(tb)) {
 		PyErr_SetString(PyExc_TypeError,
-			   "raise 3rd arg must be traceback or None");
+			   "raise: arg 3 must be a traceback or None");
 		goto raise_error;
 	}
 
@@ -2630,6 +2640,7 @@
 call_builtin(PyObject *func, PyObject *arg, PyObject *kw)
 {
 	if (PyCFunction_Check(func)) {
+		PyCFunctionObject* f = (PyCFunctionObject*) func;
 		PyCFunction meth = PyCFunction_GetFunction(func);
 		PyObject *self = PyCFunction_GetSelf(func);
 		int flags = PyCFunction_GetFlags(func);
@@ -2643,8 +2654,9 @@
 		if (flags & METH_KEYWORDS)
 			return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
 		if (kw != NULL && PyDict_Size(kw) != 0) {
-			PyErr_SetString(PyExc_TypeError,
-				   "this function takes no keyword arguments");
+			PyErr_Format(PyExc_TypeError,
+				"%.200s() takes no keyword arguments",
+				f->m_ml->ml_name);
 			return NULL;
 		}
 		return (*meth)(self, arg);
@@ -2653,11 +2665,13 @@
 		return PyInstance_New(func, arg, kw);
 	}
 	if (PyInstance_Check(func)) {
-	        PyObject *res, *call = PyObject_GetAttrString(func,"__call__");
+	        PyObject *res, *call = PyObject_GetAttrString(func, "__call__");
 		if (call == NULL) {
+			PyInstanceObject *inst = (PyInstanceObject*) func;
 			PyErr_Clear();
-			PyErr_SetString(PyExc_AttributeError,
-				   "no __call__ method defined");
+			PyErr_Format(PyExc_AttributeError,
+				"%.200s instance has no __call__ method",
+				PyString_AsString(inst->in_class->cl_name));
 			return NULL;
 		}
 		res = PyEval_CallObjectWithKeywords(call, arg, kw);
@@ -2703,7 +2717,7 @@
 			}
 			if (self == NULL) {
 				PyErr_SetString(PyExc_TypeError,
-	   "unbound method must be called with class instance 1st argument");
+	   "unbound method must be called with instance as first argument");
 				return NULL;
 			}
 			Py_INCREF(arg);
@@ -2849,7 +2863,7 @@
 			}
 		} else {
 			PyErr_SetString(PyExc_TypeError,
-					"slice index must be int");
+					"slice indices must be integers");
 			return 0;
 		}
 		/* Truncate -- very long indices are truncated anyway */
@@ -2935,7 +2949,7 @@
 	PyObject *w, *x;
 	if (!PyModule_Check(v)) {
 		PyErr_SetString(PyExc_TypeError,
-				"import-from requires module object");
+				"import-from requires a module object");
 		return NULL;
 	}
 	w = PyModule_GetDict(v); /* TDB: can this not fail ? */
@@ -2958,7 +2972,7 @@
 
 	if (!PyModule_Check(v)) {
 		PyErr_SetString(PyExc_TypeError,
-				"import-from requires module object");
+				"import-from requires a module object");
 		return -1;
 	}
 	w = PyModule_GetDict(v); /* TBD: can this not fail ? */
@@ -3068,12 +3082,17 @@
 	    !PyCode_Check(prog) &&
 	    !PyFile_Check(prog)) {
 		PyErr_SetString(PyExc_TypeError,
-			   "exec 1st arg must be string, code or file object");
+			   "exec: arg 1 must be a string, file, or code object");
 		return -1;
 	}
-	if (!PyDict_Check(globals) || !PyDict_Check(locals)) {
+	if (!PyDict_Check(globals)) {
 		PyErr_SetString(PyExc_TypeError,
-		    "exec 2nd/3rd args must be dict or None");
+		    "exec: arg 2 must be a dictionary or None");
+		return -1;
+	}
+	if (!PyDict_Check(locals)) {
+		PyErr_SetString(PyExc_TypeError,
+		    "exec: arg 3 must be a dictionary or None");
 		return -1;
 	}
 	if (PyDict_GetItemString(globals, "__builtins__") == NULL)
diff --git a/Python/errors.c b/Python/errors.c
index 28dfbbe..3053e00 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -224,7 +224,7 @@
 PyErr_BadArgument(void)
 {
 	PyErr_SetString(PyExc_TypeError,
-			"illegal argument type for built-in operation");
+			"bad argument type for built-in operation");
 	return 0;
 }
 
diff --git a/Python/exceptions.c b/Python/exceptions.c
index 6d6291c..a95817c 100644
--- a/Python/exceptions.c
+++ b/Python/exceptions.c
@@ -188,7 +188,7 @@
 	/* Watch out for being called to early in the bootstrapping process */
 	if (PyExc_TypeError) {
 	    PyErr_SetString(PyExc_TypeError,
-	     "unbound method must be called with class instance 1st argument");
+	     "unbound method must be called with instance as first argument");
 	}
         return NULL;
     }