Switch the state variable to unsigned for defined wrap-around behavior.
This commit is contained in:
parent
30c9074b96
commit
f9d9c79aa8
|
@ -62,7 +62,7 @@ typedef struct {
|
||||||
block *rightblock;
|
block *rightblock;
|
||||||
Py_ssize_t leftindex; /* in range(BLOCKLEN) */
|
Py_ssize_t leftindex; /* in range(BLOCKLEN) */
|
||||||
Py_ssize_t rightindex; /* in range(BLOCKLEN) */
|
Py_ssize_t rightindex; /* in range(BLOCKLEN) */
|
||||||
long state; /* incremented whenever the indices move */
|
size_t state; /* incremented whenever the indices move */
|
||||||
Py_ssize_t maxlen;
|
Py_ssize_t maxlen;
|
||||||
PyObject *weakreflist; /* List of weak references */
|
PyObject *weakreflist; /* List of weak references */
|
||||||
} dequeobject;
|
} dequeobject;
|
||||||
|
@ -692,8 +692,8 @@ deque_count(dequeobject *deque, PyObject *v)
|
||||||
Py_ssize_t n = Py_SIZE(deque);
|
Py_ssize_t n = Py_SIZE(deque);
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
Py_ssize_t count = 0;
|
Py_ssize_t count = 0;
|
||||||
|
size_t start_state = deque->state;
|
||||||
PyObject *item;
|
PyObject *item;
|
||||||
long start_state = deque->state;
|
|
||||||
int cmp;
|
int cmp;
|
||||||
|
|
||||||
for (i=0 ; i<n ; i++) {
|
for (i=0 ; i<n ; i++) {
|
||||||
|
@ -1257,7 +1257,7 @@ typedef struct {
|
||||||
Py_ssize_t index;
|
Py_ssize_t index;
|
||||||
block *b;
|
block *b;
|
||||||
dequeobject *deque;
|
dequeobject *deque;
|
||||||
long state; /* state when the iterator is created */
|
size_t state; /* state when the iterator is created */
|
||||||
Py_ssize_t counter; /* number of items remaining for iteration */
|
Py_ssize_t counter; /* number of items remaining for iteration */
|
||||||
} dequeiterobject;
|
} dequeiterobject;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue