Patch #1507676: improve exception messages in abstract.c, object.c and typeobject.c.
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 0881ab1..439676f 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -1470,8 +1470,9 @@
 		return -1;
 	}
 	if (value != NULL && !PyDict_Check(value)) {
-		PyErr_SetString(PyExc_TypeError,
-				"__dict__ must be set to a dictionary");
+		PyErr_Format(PyExc_TypeError,
+			     "__dict__ must be set to a dictionary, "
+			     "not a '%.200s'", value->ob_type->tp_name);
 		return -1;
 	}
 	dict = *dictptr;
@@ -1534,8 +1535,9 @@
 	Py_ssize_t i, n;
 
 	if (!PyString_Check(s)) {
-		PyErr_SetString(PyExc_TypeError,
-				"__slots__ must be strings");
+		PyErr_Format(PyExc_TypeError,
+			     "__slots__ items must be strings, not '%.200s'",
+			     s->ob_type->tp_name);
 		return 0;
 	}
 	p = (unsigned char *) PyString_AS_STRING(s);
@@ -2575,8 +2577,9 @@
 		args = PyObject_CallObject(getnewargs, NULL);
 		Py_DECREF(getnewargs);
 		if (args != NULL && !PyTuple_Check(args)) {
-			PyErr_SetString(PyExc_TypeError,
-				"__getnewargs__ should return a tuple");
+			PyErr_Format(PyExc_TypeError,
+				"__getnewargs__ should return a tuple, "
+				"not '%.200s'", args->ob_type->tp_name);
 			goto end;
 		}
 	}
@@ -4352,8 +4355,9 @@
 		result = temp->ob_type->tp_as_number->nb_index(temp);
 	}
 	else {
-		PyErr_SetString(PyExc_TypeError, 
-				"__index__ must return an int or a long");
+		PyErr_Format(PyExc_TypeError, 
+			     "__index__ must return an int or a long, "
+			     "not '%.200s'", temp->ob_type->tp_name);
 		result = -1;
 	}
 	Py_DECREF(temp);
@@ -4564,8 +4568,9 @@
 			func = lookup_method(self, "__cmp__", &cmp_str);
 		}
 		if (func != NULL) {
+			PyErr_Format(PyExc_TypeError, "unhashable type: '%.200s'",
+				     self->ob_type->tp_name);
 			Py_DECREF(func);
-			PyErr_SetString(PyExc_TypeError, "unhashable type");
 			return -1;
 		}
 		PyErr_Clear();
@@ -4742,8 +4747,9 @@
 	PyErr_Clear();
 	func = lookup_method(self, "__getitem__", &getitem_str);
 	if (func == NULL) {
-		PyErr_SetString(PyExc_TypeError,
-				"iteration over non-sequence");
+		PyErr_Format(PyExc_TypeError,
+			     "'%.200s' object is not iterable",
+			     self->ob_type->tp_name);
 		return NULL;
 	}
 	Py_DECREF(func);
@@ -4816,8 +4822,9 @@
 	if (res == NULL)
 		return -1;
 	if (res != Py_None) {
-		PyErr_SetString(PyExc_TypeError,
-			   "__init__() should return None");
+		PyErr_Format(PyExc_TypeError,
+			     "__init__() should return None, not '%.200s'",
+			     res->ob_type->tp_name);
 		Py_DECREF(res);
 		return -1;
 	}