Skip to content

Commit d12fbe9

Browse files
committed
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.
1 parent 7fedbe5 commit d12fbe9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Objects/abstract.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ PyNumber_Index(PyObject *item)
12401240
return NULL;
12411241
}
12421242
}
1243-
else if (m && m->nb_int != NULL) {
1243+
else if (m && m->nb_int != NULL && m->nb_float == NULL) {
12441244
result = m->nb_int(item);
12451245
if (result && !PyLong_Check(result)) {
12461246
PyErr_Format(PyExc_TypeError,

0 commit comments

Comments
 (0)