Index: Python/ceval.c =================================================================== --- Python/ceval.c (révision 84514) +++ Python/ceval.c (copie de travail) @@ -1563,7 +1563,30 @@ TARGET(BINARY_SUBSCR) w = POP(); v = TOP(); + if (PyLong_CheckExact(w)) { + int is_tuple = PyTuple_CheckExact(v); + if (is_tuple || PyList_CheckExact(v)) { + Py_ssize_t i = -1; + Py_ssize_t vlen = Py_SIZE(v); + Py_ssize_t ndigits = Py_SIZE(w); + if (ndigits == 0) + i = 0; + else if (ndigits == 1) + i = ((PyLongObject *) w)->ob_digit[0]; + else if (ndigits == -1) + i = vlen - ((PyLongObject *) w)->ob_digit[0]; + if (i >= 0 && i < vlen) { + if (is_tuple) + x = PyTuple_GET_ITEM(v, i); + else + x = PyList_GET_ITEM(v, i); + Py_INCREF(x); + goto BINARY_SUBSCR_end; + } + } + } x = PyObject_GetItem(v, w); + BINARY_SUBSCR_end: Py_DECREF(v); Py_DECREF(w); SET_TOP(x);