]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix compiler warning on Windows 64-bit: asdl_seq_SET() stores the index parameter
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 15 Nov 2013 23:16:58 +0000 (00:16 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 15 Nov 2013 23:16:58 +0000 (00:16 +0100)
into a Py_ssize_t, instead of an int

Include/asdl.h

index 7c3b6d1ba7f793452a3a6cf1af4c7ad1bed0a25a..495153c576ffb9ae25919e6705a18f8c8debd98c 100644 (file)
@@ -31,11 +31,13 @@ asdl_int_seq *_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena);
 #define asdl_seq_GET(S, I) (S)->elements[(I)]
 #define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size)
 #ifdef Py_DEBUG
-#define asdl_seq_SET(S, I, V) { \
-        int _asdl_i = (I); \
-        assert((S) && _asdl_i < (S)->size); \
+#define asdl_seq_SET(S, I, V) \
+    do { \
+        Py_ssize_t _asdl_i = (I); \
+        assert((S) != NULL); \
+        assert(_asdl_i < (S)->size); \
         (S)->elements[_asdl_i] = (V); \
-}
+    } while (0)
 #else
 #define asdl_seq_SET(S, I, V) (S)->elements[I] = (V)
 #endif