]> granicus.if.org Git - python/commitdiff
Fix compiler warning (on Windows 64-bit): explicit cast Py_ssize_t to unsigned
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 15 Nov 2013 23:13:29 +0000 (00:13 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 15 Nov 2013 23:13:29 +0000 (00:13 +0100)
char, n is in range [0; 255] (a tuple cannot have a negative length)

Python/marshal.c

index e211a0f01825a50aa086a1a15e66422d449da1e4..dc5411c1ff76756a13a743ab96cf5bb6c9203f18 100644 (file)
@@ -80,7 +80,7 @@ typedef struct {
 
 #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 @@ w_complex_object(PyObject *v, char flag, WFILE *p)
         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);