http://bugs.python.org/review/15469/diff/5535/Modules/_collectionsmodule.c File Modules/_collectionsmodule.c (right): http://bugs.python.org/review/15469/diff/5535/Modules/_collectionsmodule.c#ne... Modules/_collectionsmodule.c:942: for (b = deque->leftblock; b != NULL; b = b->rightlink) { I think you can compute the number of blocks by rounding up deque->len/BLOCKLEN; no need to iterate over the deque.