diff options
-rw-r--r-- | Lib/test/test_marshal.py | 3 | ||||
-rw-r--r-- | Python/marshal.c | 12 |
2 files changed, 9 insertions, 6 deletions
diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py index 5377224..9237af0 100644 --- a/Lib/test/test_marshal.py +++ b/Lib/test/test_marshal.py @@ -39,3 +39,6 @@ for base in maxint64, minint64, -maxint64, -(minint64 >> 1): base = 0 else: base >>= 1 + +# Simple-minded check for SF 588452: Debug build crashes +marshal.dumps([128] * 1000) diff --git a/Python/marshal.c b/Python/marshal.c index 0df46cf..c00586d 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -84,17 +84,17 @@ w_string(char *s, int n, WFILE *p) static void w_short(int x, WFILE *p) { - w_byte( x & 0xff, p); - w_byte((x>> 8) & 0xff, p); + w_byte((char)( x & 0xff), p); + w_byte((char)((x>> 8) & 0xff), p); } static void w_long(long x, WFILE *p) { - w_byte((int)( x & 0xff), p); - w_byte((int)((x>> 8) & 0xff), p); - w_byte((int)((x>>16) & 0xff), p); - w_byte((int)((x>>24) & 0xff), p); + w_byte((char)( x & 0xff), p); + w_byte((char)((x>> 8) & 0xff), p); + w_byte((char)((x>>16) & 0xff), p); + w_byte((char)((x>>24) & 0xff), p); } #if SIZEOF_LONG > 4 |