From: Trent Nelson Date: Thu, 10 Apr 2008 22:21:23 +0000 (+0000) Subject: Fix change to PyNumber_Index() made in r62269, which incorrectly allowed floats to... X-Git-Tag: v3.0a5~103 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d12fbe9ef788d349fbd42e1b4d054975b829ccbf;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Objects/abstract.c b/Objects/abstract.c index 6335aa2cae9c..684b0b4abd27 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,