summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrent Nelson <trent.nelson@snakebite.org>2008-04-10 22:21:23 +0000
committerTrent Nelson <trent.nelson@snakebite.org>2008-04-10 22:21:23 +0000
commit62d3f2647c173f50bf62ecfd84ca15187c3f586b (patch)
tree86635d869efa17bc9926018b8b8c4f2503786de1
parent9f5bd1bf4c71ee4e73f2a57b44219ef0cf07f67b (diff)
downloadcpython-62d3f2647c173f50bf62ecfd84ca15187c3f586b.tar.gz
Fix change to PyNumber_Index() made in r62269, which incorrectly allowed floats to be interpreted as longs. Thanks to Benjamin Peterson for picking this up.
-rw-r--r--Objects/abstract.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 6335aa2cae..684b0b4abd 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -1240,7 +1240,7 @@ PyNumber_Index(PyObject *item)
return NULL;
}
}
- else if (m && m->nb_int != NULL) {
+ else if (m && m->nb_int != NULL && m->nb_float == NULL) {
result = m->nb_int(item);
if (result && !PyLong_Check(result)) {
PyErr_Format(PyExc_TypeError,