mirror of https://github.com/python/cpython
Add an early-out for deque_clear()
This commit is contained in:
parent
17f9716676
commit
38031143fb
|
@ -595,6 +595,9 @@ deque_clear(dequeobject *deque)
|
|||
Py_ssize_t n;
|
||||
PyObject *item;
|
||||
|
||||
if (Py_SIZE(deque) == 0)
|
||||
return;
|
||||
|
||||
/* During the process of clearing a deque, decrefs can cause the
|
||||
deque to mutate. To avoid fatal confusion, we have to make the
|
||||
deque empty before clearing the blocks and never refer to
|
||||
|
|
Loading…
Reference in New Issue