mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Add an early-out for deque_clear()
This commit is contained in:
parent
17f9716676
commit
38031143fb
1 changed files with 3 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue