Index: Objects/tupleobject.c =================================================================== --- Objects/tupleobject.c (Revision 52516) +++ Objects/tupleobject.c (Arbeitskopie) @@ -620,8 +620,9 @@ } } else { - PyErr_SetString(PyExc_TypeError, - "tuple indices must be integers"); + PyErr_Format(PyExc_TypeError, + "tuple indices must be integers, not %.200s", + item->ob_type->tp_name); return NULL; } } Index: Objects/listobject.c =================================================================== --- Objects/listobject.c (Revision 52516) +++ Objects/listobject.c (Arbeitskopie) @@ -946,9 +946,10 @@ if (res == NULL) return -1; if (!PyInt_Check(res)) { + PyErr_Format(PyExc_TypeError, + "comparison function must return int, not %.200s", + res->ob_type->tp_name); Py_DECREF(res); - PyErr_SetString(PyExc_TypeError, - "comparison function must return int"); return -1; } i = PyInt_AsLong(res); @@ -2491,8 +2492,9 @@ } } else { - PyErr_SetString(PyExc_TypeError, - "list indices must be integers"); + PyErr_Format(PyExc_TypeError, + "list indices must be integers, not %.200s", + item->ob_type->tp_name); return NULL; } } @@ -2635,8 +2637,9 @@ } } else { - PyErr_SetString(PyExc_TypeError, - "list indices must be integers"); + PyErr_Format(PyExc_TypeError, + "list indices must be integers, not %.200s", + item->ob_type->tp_name); return -1; } } Index: Objects/stringobject.c =================================================================== --- Objects/stringobject.c (Revision 52516) +++ Objects/stringobject.c (Arbeitskopie) @@ -1071,8 +1071,9 @@ return PyUnicode_Contains(str_obj, sub_obj); #endif if (!PyString_Check(sub_obj)) { - PyErr_SetString(PyExc_TypeError, - "'in ' requires string as left operand"); + PyErr_Format(PyExc_TypeError, + "'in ' requires string as left operand, " + "not %.200s", sub_obj->ob_type->tp_name); return -1; } } @@ -1240,8 +1241,9 @@ } } else { - PyErr_SetString(PyExc_TypeError, - "string indices must be integers"); + PyErr_Format(PyExc_TypeError, + "string indices must be integers, not %.200s", + item->ob_type->tp_name); return NULL; } } @@ -4343,7 +4345,8 @@ x = PyInt_AsLong(v); if (x == -1 && PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, "int argument required"); + PyErr_Format(PyExc_TypeError, "int argument required, not %.200s", + v->ob_type->tp_name); return -1; } if (x < 0 && type == 'u') {