summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-08-15 06:29:03 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-08-15 06:29:03 (GMT)
commit271a8689e98bc725ca9207dee52443d61f99211f (patch)
tree8b9ff92c386916fe9762d598080332d848689e1f /Objects
parent6e482569c8cba727d803e2283ae1481c5c308d54 (diff)
downloadcpython-271a8689e98bc725ca9207dee52443d61f99211f.zip
cpython-271a8689e98bc725ca9207dee52443d61f99211f.tar.gz
cpython-271a8689e98bc725ca9207dee52443d61f99211f.tar.bz2
Subclasses of int/long are allowed to define an __index__.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index c8e9ddc..a18bb78 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -945,16 +945,14 @@ PyNumber_Index(PyObject *item)
PyObject *result = NULL;
if (item == NULL)
return null_error();
- /* XXX(nnorwitz): should these be CheckExact? Aren't subclasses ok? */
- if (PyInt_CheckExact(item) || PyLong_CheckExact(item)) {
+ if (PyInt_Check(item) || PyLong_Check(item)) {
Py_INCREF(item);
return item;
}
if (PyIndex_Check(item)) {
result = item->ob_type->tp_as_number->nb_index(item);
- /* XXX(nnorwitz): Aren't subclasses ok here too? */
if (result &&
- !PyInt_CheckExact(result) && !PyLong_CheckExact(result)) {
+ !PyInt_Check(result) && !PyLong_Check(result)) {
PyErr_Format(PyExc_TypeError,
"__index__ returned non-(int,long) " \
"(type %.200s)",