From: Raymond Hettinger Date: Tue, 3 Mar 2015 06:47:46 +0000 (-0800) Subject: Switch the state variable to unsigned for defined wrap-around behavior. X-Git-Tag: v3.5.0a2~38 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f9d9c79aa85c6548395888b1142022deb4e18ee0;p=thirdparty%2FPython%2Fcpython.git Switch the state variable to unsigned for defined wrap-around behavior. --- diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 2546c59fcd89..96049f3f6788 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