mirror of
https://github.com/python/cpython.git
synced 2024-11-29 04:44:13 +08:00
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.
This commit is contained in:
parent
7fedbe513d
commit
d12fbe9ef7
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user