[issue1202] zlib.crc32() and adler32() return value

Gregory P. Smith report at bugs.python.org
Mon Mar 17 17:27:12 CET 2008


Gregory P. Smith <greg at krypto.org> added the comment:

working on this now.  foo = 'abcdefghijklmnop'

2.x 32-bit long: zlib.crc32(foo) returns -1808088941
2.x 64-bit long: zlib.crc32(foo) returns 2486878355

This is because PyInt_FromLong() happily fits the value into a signed
long internally to the integer object on 64-bit platforms.  They are
both the same number if considered with & 0xffffffff.

I'm doing as guido suggests and leaving this slightly odd behavior for
2.x so that crc32 and adler32 always return an integer object.  in 3.0
they'll always return an unsigned value.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1202>
__________________________________


More information about the Python-bugs-list mailing list