[Python-checkins] cpython: Add safecase to silence Win64 warning.

martin.v.loewis python-checkins at python.org
Tue May 15 14:35:24 CEST 2012


http://hg.python.org/cpython/rev/d274fa027cf5
changeset:   76946:d274fa027cf5
user:        Martin v. Löwis <martin at v.loewis.de>
date:        Tue May 15 14:34:58 2012 +0200
summary:
  Add safecase to silence Win64 warning.

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


diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -533,7 +533,8 @@
         tdo->values[i] = PyList_GET_ITEM(values, i);
         Py_INCREF(tdo->values[i]);
     }
-    tdo->numread = len;
+    /* len <= LINKCELLS < INT_MAX */
+    tdo->numread = Py_SAFE_DOWNCAST(len, Py_ssize_t, int);
 
     if (len == LINKCELLS) {
         if (next != Py_None) {

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


More information about the Python-checkins mailing list