Patch #1507676: improve exception messages in abstract.c, object.c and typeobject.c.
diff --git a/Objects/object.c b/Objects/object.c
index 59d3960..73c8941 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1068,7 +1068,8 @@
 		return _Py_HashPointer(v); /* Use address as hash value */
 	}
 	/* If there's a cmp but no hash defined, the object can't be hashed */
-	PyErr_SetString(PyExc_TypeError, "unhashable type");
+	PyErr_Format(PyExc_TypeError, "unhashable type: '%.200s'",
+		     v->ob_type->tp_name);
 	return -1;
 }
 
@@ -1133,8 +1134,9 @@
 		else
 #endif
 		{
-			PyErr_SetString(PyExc_TypeError,
-					"attribute name must be string");
+			PyErr_Format(PyExc_TypeError,
+				     "attribute name must be string, not '%.200s'",
+				     name->ob_type->tp_name);
 			return NULL;
 		}
 	}
@@ -1179,8 +1181,9 @@
 		else
 #endif
 		{
-			PyErr_SetString(PyExc_TypeError,
-					"attribute name must be string");
+			PyErr_Format(PyExc_TypeError,
+				     "attribute name must be string, not '%.200s'",
+				     name->ob_type->tp_name);
 			return -1;
 		}
 	}
@@ -1277,8 +1280,9 @@
 		else
 #endif
 		{
-			PyErr_SetString(PyExc_TypeError,
-					"attribute name must be string");
+			PyErr_Format(PyExc_TypeError,
+				     "attribute name must be string, not '%.200s'",
+				     name->ob_type->tp_name);
 			return NULL;
 		}
 	}
@@ -1399,8 +1403,9 @@
 		else
 #endif
 		{
-			PyErr_SetString(PyExc_TypeError,
-					"attribute name must be string");
+			PyErr_Format(PyExc_TypeError,
+				     "attribute name must be string, not '%.200s'",
+				     name->ob_type->tp_name);
 			return -1;
 		}
 	}
@@ -1450,7 +1455,7 @@
 
 	if (descr == NULL) {
 		PyErr_Format(PyExc_AttributeError,
-			     "'%.50s' object has no attribute '%.400s'",
+			     "'%.100s' object has no attribute '%.200s'",
 			     tp->tp_name, PyString_AS_STRING(name));
 		goto done;
 	}
@@ -1773,8 +1778,9 @@
 
 	assert(result);
 	if (!PyList_Check(result)) {
-		PyErr_SetString(PyExc_TypeError,
-			"Expected keys() to be a list.");
+		PyErr_Format(PyExc_TypeError,
+			"Expected keys() to be a list, not '%.200s'",
+			result->ob_type->tp_name);
 		goto error;
 	}
 	if (PyList_Sort(result) != 0)