[Python-checkins] cpython: Fix compiler warning (on Windows 64-bit): explicit cast Py_ssize_t to unsigned

victor.stinner python-checkins at python.org
Sat Nov 16 00:34:15 CET 2013


http://hg.python.org/cpython/rev/e086cb1c6e5a
changeset:   87131:e086cb1c6e5a
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Nov 16 00:13:29 2013 +0100
summary:
  Fix compiler warning (on Windows 64-bit): explicit cast Py_ssize_t to unsigned
char, n is in range [0; 255] (a tuple cannot have a negative length)

files:
  Python/marshal.c |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Python/marshal.c b/Python/marshal.c
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -80,7 +80,7 @@
 
 #define w_byte(c, p) if (((p)->fp)) putc((c), (p)->fp); \
                       else if ((p)->ptr != (p)->end) *(p)->ptr++ = (c); \
-                           else w_more(c, p)
+                           else w_more((c), p)
 
 static void
 w_more(char c, WFILE *p)
@@ -448,7 +448,7 @@
         n = PyTuple_Size(v);
         if (p->version >= 4 && n < 256) {
             W_TYPE(TYPE_SMALL_TUPLE, p);
-            w_byte(n, p);
+            w_byte((unsigned char)n, p);
         }
         else {
             W_TYPE(TYPE_TUPLE, p);

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


More information about the Python-checkins mailing list