[Python-checkins] r61810 - python/trunk/Modules/zlibmodule.c

gregory.p.smith python-checkins at python.org
Sun Mar 23 21:31:23 CET 2008


Author: gregory.p.smith
Date: Sun Mar 23 21:31:23 2008
New Revision: 61810

Modified:
   python/trunk/Modules/zlibmodule.c
Log:
Revert r61779 - It undid correct code and caused test_zlib to fail on all
platforms with a 64-bit long.

The Alpha/Tru64 test problem is a problem in either tarfile or test_tarfile,
not zlib.

crc32 and adler32 return 32-bit values.  by using a long thats larger than
32-bits in these functions they were prevented from wrapping around to their
signed 32-bit value that we want them to return in python 2.x.


Modified: python/trunk/Modules/zlibmodule.c
==============================================================================
--- python/trunk/Modules/zlibmodule.c	(original)
+++ python/trunk/Modules/zlibmodule.c	Sun Mar 23 21:31:23 2008
@@ -891,8 +891,7 @@
 {
     uLong adler32val = adler32(0L, Z_NULL, 0);
     Byte *buf;
-    int len;
-    long signed_val;
+    int len, signed_val;
 
     if (!PyArg_ParseTuple(args, "s#|k:adler32", &buf, &len, &adler32val))
 	return NULL;
@@ -915,8 +914,7 @@
 {
     uLong crc32val = crc32(0L, Z_NULL, 0);
     Byte *buf;
-    int len;
-    long signed_val;
+    int len, signed_val;
 
     if (!PyArg_ParseTuple(args, "s#|k:crc32", &buf, &len, &crc32val))
 	return NULL;


More information about the Python-checkins mailing list