collections.deque: Fix `MemoryError: memory allocation failed` on multiple calls of `deque.appendleft`.