This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix confusing versionchanged note in crc32 and adler32
Type: Stage: resolved
Components: Documentation, Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: docs@python, gregory.p.smith, malin, miss-islington
Priority: normal Keywords: patch

Created on 2022-03-17 05:35 by malin, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 31955 merged malin, 2022-03-17 05:57
PR 32002 merged malin, 2022-03-20 04:39
PR 32004 merged miss-islington, 2022-03-20 06:57
Messages (8)
msg415386 - (view) Author: Ma Lin (malin) * Date: 2022-03-17 05:35
Since CPython 3.0.0, the checksums are always truncated to `unsigned int`:
https://github.com/python/cpython/blob/v3.0/Modules/zlibmodule.c#L930
https://github.com/python/cpython/blob/v3.0/Modules/zlibmodule.c#L950
msg415389 - (view) Author: Ma Lin (malin) * Date: 2022-03-17 07:01
`binascii.crc32` doc also has this invalid document:
doc: https://docs.python.org/3/library/binascii.html#binascii.crc32
3.0.0 code: https://github.com/python/cpython/blob/v3.0/Modules/binascii.c#L1035

In addition, `binascii.crc32` has an `USE_ZLIB_CRC32` code path, but it's buggy.
The length of zlib `crc32()` function is `unsigned int`, so if use `USE_ZLIB_CRC32` code path and the data > 4GiB, the result is wrong.
Should we remove `USE_ZLIB_CRC32` code path in `binascii.c`, or fix it?

`USE_ZLIB_CRC32` code path in binascii.c (bug code): 
https://github.com/python/cpython/blob/v3.11.0a6/Modules/binascii.c#L756-L767
crc32 in zlibmodule.c, it uses an UINT_MAX sliding window (right code):
 https://github.com/python/cpython/blob/v3.11.0a6/Modules/zlibmodule.c#L1436
msg415574 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2022-03-19 21:42
New changeset b3f2d4c8bab52573605c96c809a1e2162eee9d7e by Ma Lin in branch 'main':
bpo-47040: improve document of checksum functions (gh-31955)
https://github.com/python/cpython/commit/b3f2d4c8bab52573605c96c809a1e2162eee9d7e
msg415582 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2022-03-19 23:07
FYI - https://bugs.python.org/issue38256 covers the 32-bit bug.
msg415583 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2022-03-19 23:08
If you want to backport the documentation updates, feel free to make PRs for that.
msg415592 - (view) Author: Ma Lin (malin) * Date: 2022-03-20 04:43
PR 32002 is for 3.10/3.9 branches.
msg415594 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2022-03-20 06:57
New changeset 6d290d5862375799e997f1192ef56abca4e9182e by Ma Lin in branch '3.10':
[3.10] bpo-47040: improve document of checksum functions (GH-31955) (GH-32002)
https://github.com/python/cpython/commit/6d290d5862375799e997f1192ef56abca4e9182e
msg415595 - (view) Author: miss-islington (miss-islington) Date: 2022-03-20 07:21
New changeset 73f4b475d1d70c9ef0db9e6c79771d1a43d43a33 by Miss Islington (bot) in branch '3.9':
[3.10] bpo-47040: improve document of checksum functions (GH-31955) (GH-32002)
https://github.com/python/cpython/commit/73f4b475d1d70c9ef0db9e6c79771d1a43d43a33
History
Date User Action Args
2022-04-11 14:59:57adminsetgithub: 91196
2022-03-20 07:21:41miss-islingtonsetmessages: + msg415595
2022-03-20 06:57:35miss-islingtonsetnosy: + miss-islington

pull_requests: + pull_request30092
2022-03-20 06:57:16gregory.p.smithsetmessages: + msg415594
2022-03-20 04:43:37malinsetmessages: + msg415592
2022-03-20 04:39:49malinsetpull_requests: + pull_request30090
2022-03-19 23:08:03gregory.p.smithsetstatus: open -> closed
messages: + msg415583

assignee: docs@python -> gregory.p.smith
resolution: fixed
stage: patch review -> resolved
2022-03-19 23:07:12gregory.p.smithsetmessages: + msg415582
2022-03-19 21:45:56gregory.p.smithsettitle: Remove invalid versionchanged in doc -> Fix confusing versionchanged note in crc32 and adler32
2022-03-19 21:42:22gregory.p.smithsetmessages: + msg415574
2022-03-17 07:01:08malinsetmessages: + msg415389
title: Remove an invalid versionchanged in doc -> Remove invalid versionchanged in doc
2022-03-17 05:57:25malinsetkeywords: + patch
stage: patch review
pull_requests: + pull_request30046
2022-03-17 05:35:08malincreate