]> granicus.if.org Git - python/commitdiff
struct_pack(): Repair new assert-fail crash in
authorTim Peters <tim.peters@gmail.com>
Thu, 16 Feb 2006 20:19:46 +0000 (20:19 +0000)
committerTim Peters <tim.peters@gmail.com>
Thu, 16 Feb 2006 20:19:46 +0000 (20:19 +0000)
debug-build test_struct on a box where plain "char"
is signed.

Modules/structmodule.c

index 2fa6e909c5597f28f8ee1047ddf984e2e14edb6e..4713c0cf76bc94dc40ddcd905ec0f9f32ab5a3b4 100644 (file)
@@ -1134,7 +1134,7 @@ struct_pack(PyObject *self, PyObject *args)
                                if (n > 255)
                                        n = 255;
                                /* store the length byte */
-                               *res++ = Py_SAFE_DOWNCAST(n, Py_ssize_t, char);
+                               *res++ = Py_SAFE_DOWNCAST(n, Py_ssize_t, unsigned char);
                                res += num;
                                break;
                        }