diff Python/marshal.c @ 24434:9ef82377669d legacy-trunk

Fix SF 588452: debug build crashes on marshal.dumps([128] * 1000). See there for a description. Added test case. Bugfix candidate for 2.2.x, not sure about previous versions: probably low priority, because virtually no one runs debug builds.
author Thomas Heller <theller@ctypes.org>
date Tue, 30 Jul 2002 11:40:57 +0000
parents d6ae544acd24
children 7dc3f4077e59
line wrap: on
line diff
--- a/Python/marshal.c	Tue Jul 30 09:49:29 2002 +0000
+++ b/Python/marshal.c	Tue Jul 30 11:40:57 2002 +0000
@@ -84,17 +84,17 @@
 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