summaryrefslogtreecommitdiffstats
path: root/Modules/collectionsmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/collectionsmodule.c')
-rw-r--r--Modules/collectionsmodule.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/Modules/collectionsmodule.c b/Modules/collectionsmodule.c
index 49c486f..2fbd729 100644
--- a/Modules/collectionsmodule.c
+++ b/Modules/collectionsmodule.c
@@ -376,14 +376,14 @@ deque_remove(dequeobject *deque, PyObject *value)
for (i=0 ; i<n ; i++) {
PyObject *item = deque->leftblock->data[deque->leftindex];
int cmp = PyObject_RichCompareBool(item, value, Py_EQ);
+
+ if (deque->len != n) {
+ PyErr_SetString(PyExc_IndexError,
+ "deque mutated during remove().");
+ return NULL;
+ }
if (cmp > 0) {
- PyObject *tgt;
- if (deque->len != n) {
- PyErr_SetString(PyExc_IndexError,
- "deque mutated during remove().");
- return NULL;
- }
- tgt = deque_popleft(deque, NULL);
+ PyObject *tgt = deque_popleft(deque, NULL);
assert (tgt != NULL);
Py_DECREF(tgt);
if (_deque_rotate(deque, i) == -1)