diff Modules/zlibmodule.c @ 35914:3fd97de0a790 legacy-trunk

[Patch #1350573] zlib.crc32 doesn't handle 0xffffffff seed. Add tests and bugfix. Bug reported by John Schmidt; bugfix by Danny Yoo.
author Andrew M. Kuchling <amk@amk.ca>
date Tue, 22 Nov 2005 15:32:28 +0000
parents b2ecda4dd70f
children b068aee1dfb5 1af7f719ed28
line wrap: on
line diff
--- a/Modules/zlibmodule.c	Tue Nov 22 15:14:44 2005 +0000
+++ b/Modules/zlibmodule.c	Tue Nov 22 15:32:28 2005 +0000
@@ -778,7 +778,7 @@
     Byte *buf;
     int len;
 
-    if (!PyArg_ParseTuple(args, "s#|l:adler32", &buf, &len, &adler32val))
+    if (!PyArg_ParseTuple(args, "s#|k:adler32", &buf, &len, &adler32val))
 	return NULL;
     adler32val = adler32(adler32val, buf, len);
     return PyInt_FromLong(adler32val);
@@ -796,7 +796,7 @@
     uLong crc32val = crc32(0L, Z_NULL, 0);
     Byte *buf;
     int len;
-    if (!PyArg_ParseTuple(args, "s#|l:crc32", &buf, &len, &crc32val))
+    if (!PyArg_ParseTuple(args, "s#|k:crc32", &buf, &len, &crc32val))
 	return NULL;
     crc32val = crc32(crc32val, buf, len);
     return PyInt_FromLong(crc32val);