]> granicus.if.org Git - python/commitdiff
Fix compilation error of traceback.c on Windows
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 16 Mar 2016 08:43:14 +0000 (09:43 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Wed, 16 Mar 2016 08:43:14 +0000 (09:43 +0100)
Issue #26564.

Python/traceback.c

index a40dbd101fcc4d9253e7c706cee124ceb55bb421..8383c166dbd63802c5e99a59ab3ee7f1613ce70c 100644 (file)
@@ -509,13 +509,13 @@ _Py_DumpDecimal(int fd, unsigned long value)
 static void
 dump_hexadecimal(int fd, unsigned long value, Py_ssize_t width)
 {
-    Py_ssize_t size = sizeof(unsigned long) * 2;
-    char buffer[size + 1], *ptr, *end;
+    char buffer[sizeof(unsigned long) * 2 + 1], *ptr, *end;
+    const Py_ssize_t size = Py_ARRAY_LENGTH(buffer) - 1;
 
     if (width > size)
         width = size;
 
-    end = &buffer[Py_ARRAY_LENGTH(buffer) - 1];
+    end = &buffer[size];
     ptr = end;
     *ptr = '\0';
     do {