summaryrefslogtreecommitdiffstats
path: root/Modules/_collectionsmodule.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2015-03-03 06:47:46 (GMT)
committerRaymond Hettinger <python@rcn.com>2015-03-03 06:47:46 (GMT)
commitf9d9c79aa85c6548395888b1142022deb4e18ee0 (patch)
tree9c6e1d7fe5bb19050148be526a7de4ba56792160 /Modules/_collectionsmodule.c
parent30c9074b962052ac5542f08f799760e60763becf (diff)
downloadcpython-f9d9c79aa85c6548395888b1142022deb4e18ee0.zip
cpython-f9d9c79aa85c6548395888b1142022deb4e18ee0.tar.gz
cpython-f9d9c79aa85c6548395888b1142022deb4e18ee0.tar.bz2
Switch the state variable to unsigned for defined wrap-around behavior.
Diffstat (limited to 'Modules/_collectionsmodule.c')
-rw-r--r--Modules/_collectionsmodule.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 2546c59..96049f3 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -62,7 +62,7 @@ typedef struct {
block *rightblock;
Py_ssize_t leftindex; /* 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;
PyObject *weakreflist; /* List of weak references */
} dequeobject;
@@ -692,8 +692,8 @@ deque_count(dequeobject *deque, PyObject *v)
Py_ssize_t n = Py_SIZE(deque);
Py_ssize_t i;
Py_ssize_t count = 0;
+ size_t start_state = deque->state;
PyObject *item;
- long start_state = deque->state;
int cmp;
for (i=0 ; i<n ; i++) {
@@ -1257,7 +1257,7 @@ typedef struct {
Py_ssize_t index;
block *b;
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 */
} dequeiterobject;