summaryrefslogtreecommitdiffstats
path: root/Objects/abstract.c
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2006-03-30 14:04:02 (GMT)
committerArmin Rigo <arigo@tunes.org>2006-03-30 14:04:02 (GMT)
commit314861c568d4bf10af1102823e23c9efe648fa0c (patch)
treecead07974e0239cd84994c029462284ed37307d2 /Objects/abstract.c
parent4ef3a23a35a391602202dce10376be9e43588fa6 (diff)
downloadcpython-314861c568d4bf10af1102823e23c9efe648fa0c.zip
cpython-314861c568d4bf10af1102823e23c9efe648fa0c.tar.gz
cpython-314861c568d4bf10af1102823e23c9efe648fa0c.tar.bz2
Minor bugs in the __index__ code (PEP 357), with tests.
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r--Objects/abstract.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index bee71d8..4ef3e5a 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -942,8 +942,9 @@ PyNumber_Index(PyObject *item)
value = nb->nb_index(item);
}
else {
- PyErr_SetString(PyExc_IndexError,
- "object cannot be interpreted as an index");
+ PyErr_Format(PyExc_TypeError,
+ "'%.200s' object cannot be interpreted "
+ "as an index", item->ob_type->tp_name);
}
return value;
}