diff options
Diffstat (limited to 'Modules/_collectionsmodule.c')
-rw-r--r-- | Modules/_collectionsmodule.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 830c5b83eb..3856d83fb4 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -924,6 +924,8 @@ deque_index(dequeobject *deque, PyObject *args) if (stop < 0) stop = 0; } + if (stop > Py_SIZE(deque)) + stop = Py_SIZE(deque); for (i=0 ; i<stop ; i++) { if (i >= start) { |