]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-135532: optimize calls to `PyMem_Malloc` in SHAKE digest computation (#135744)
authorBénédikt Tran <10796600+picnixz@users.noreply.github.com>
Sat, 21 Jun 2025 12:32:00 +0000 (14:32 +0200)
committerGitHub <noreply@github.com>
Sat, 21 Jun 2025 12:32:00 +0000 (14:32 +0200)
commitd08b4b2333d28403633f9ceb86a3a5fab011d8a1
tree55f7cd985136823b123f16c4a5c0d214868817c6
parent7c4361564c3881946a5eca677607b4ffec0a566d
gh-135532: optimize calls to `PyMem_Malloc` in SHAKE digest computation (#135744)

- Add a fast path when the digest length is 0 to avoid calling useless functions.
- Directly allocate via `PyBytes_FromStringAndSize(NULL, length)` when possible.
Modules/_hashopenssl.c
Modules/sha3module.c