Kaydet (Commit) 38031143 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Add an early-out for deque_clear()

üst 17f97166
...@@ -595,6 +595,9 @@ deque_clear(dequeobject *deque) ...@@ -595,6 +595,9 @@ deque_clear(dequeobject *deque)
Py_ssize_t n; Py_ssize_t n;
PyObject *item; PyObject *item;
if (Py_SIZE(deque) == 0)
return;
/* During the process of clearing a deque, decrefs can cause the /* During the process of clearing a deque, decrefs can cause the
deque to mutate. To avoid fatal confusion, we have to make the deque to mutate. To avoid fatal confusion, we have to make the
deque empty before clearing the blocks and never refer to deque empty before clearing the blocks and never refer to
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment