PyPy2.7 (7.3.9): regression in zlib.crc32() with negative IV and zlib 1.2.12
After upgrading zlib to 1.2.12 (which apparently includes a secfix, yay!), the following test started failing:
======================================================================
FAIL: test_negative_crc_iv_input (test.test_zlib.ChecksumTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/portage/dev-python/pypy-7.3.9/work/pypy2.7-v7.3.9-src/lib-python/2.7/test/test_zlib.py", line 78, in test_negative_crc_iv_input
self.assertEqual(zlib.crc32('ham', -1), zlib.crc32('ham', 0xffffffffL))
AssertionError: 153214308 != -153214364
This test seems to be specific to Python 2. It has been added through the following cpython.git commit:
commit 88440960f9f430581ba5766aee1f0712ac96cb54
Author: Gregory P. Smith <greg@mad-scientist.com>
Date: 2008-03-25 07:12:45 +0100
A stab in the dark attempt to fix the alpha/tru64 buildbot problem and add more
test coverage of valid inputs to zlib.crc32.
If git describe
doesn't deceive me, that's around 2.6a2. FWICS py3k has never had an equivalent test.
Using CPython 2.7:
>>> zlib.crc32('ham', -1)
-153214364
>>> zlib.crc32('ham', 0xffffffffL)
-153214364
Using PyPy 3.9 or CPython 3.9:
>>>> zlib.crc32(b'ham', -1)
4141752932
>>>> zlib.crc32(b'ham', 0xffffffff)
4141752932
So I guess the problem is specific to PyPy2.7.