else:
self.assertEqual(d.index(element, start, stop), target)
+ # Test large start argument
+ d = deque(range(0, 10000, 10))
+ for step in range(100):
+ i = d.index(8500, 700)
+ self.assertEqual(d[i], 8500)
+ # Repeat test with a different internal offset
+ d.rotate()
+
def test_index_bug_24913(self):
d = deque('A' * 3)
with self.assertRaises(ValueError):
start = stop;
assert(0 <= start && start <= stop && stop <= Py_SIZE(deque));
- /* XXX Replace this loop with faster code from deque_item() */
- for (i=0 ; i<start ; i++) {
+ for (i=0 ; i < start - BLOCKLEN ; i += BLOCKLEN) {
+ b = b->rightlink;
+ }
+ for ( ; i < start ; i++) {
index++;
if (index == BLOCKLEN) {
b = b->rightlink;