[Python-checkins] cpython: Use unsigned division

raymond.hettinger python-checkins at python.org
Thu Oct 15 02:33:28 EDT 2015


https://hg.python.org/cpython/rev/5c34a834e178
changeset:   98762:5c34a834e178
user:        Raymond Hettinger <python at rcn.com>
date:        Wed Oct 14 23:33:23 2015 -0700
summary:
  Use unsigned division

files:
  Modules/_collectionsmodule.c |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -1482,7 +1482,7 @@
     Py_ssize_t blocks;
 
     res = sizeof(dequeobject);
-    blocks = (deque->leftindex + Py_SIZE(deque) + BLOCKLEN - 1) / BLOCKLEN;
+    blocks = (size_t)(deque->leftindex + Py_SIZE(deque) + BLOCKLEN - 1) / BLOCKLEN;
     assert(deque->leftindex + Py_SIZE(deque) - 1 ==
            (blocks - 1) * BLOCKLEN + deque->rightindex);
     res += blocks * sizeof(block);

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list