[Python-checkins]
python/dist/src/Modules collectionsmodule.c, 1.37, 1.38
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Sat Mar 19 01:01:35 CET 2005
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17096/Modules
Modified Files:
collectionsmodule.c
Log Message:
Apply remove's mutation test after every equality test.
Index: collectionsmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/collectionsmodule.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- collectionsmodule.c 18 Mar 2005 21:20:23 -0000 1.37
+++ collectionsmodule.c 19 Mar 2005 00:00:48 -0000 1.38
@@ -376,14 +376,14 @@
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)
More information about the Python-checkins
mailing list