]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-141907: Better handle support for SHA3 for test_hashlib (GH-141908) (#141918)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 25 Nov 2025 01:20:35 +0000 (02:20 +0100)
committerGitHub <noreply@github.com>
Tue, 25 Nov 2025 01:20:35 +0000 (02:20 +0100)
commitadd73fdda01a518840f5cfc32e0fc57d847c8419
treeeaa9057884de8aeba5afa461be0ac4e0ee56f5c9
parent7ccdbbd04e0076b2f50a9c47cae7185fb59e3e87
[3.14] gh-141907: Better handle support for SHA3 for test_hashlib (GH-141908) (#141918)

gh-141907: Better handle support for SHA3 for test_hashlib (GH-141908)

* test_hashlib: better handle support for SHA3

It's possible that the SSL library supports only SHA3 algo and doesn't
have SHAKE one.

The current test wrongly detect this and set both HASH and HASHXOF to
None expecting to have the extra SHA3 attributes present but this should
only be true for SHAKE algo.

To better handle this, move the HASH condition to a dedicated try-expect
condition and check if HASHXOF is None in the relevant code effectively
checking if SHA3 is supported by the SSL library but SHAKE algo needs to
use the sha3module one.

---------
(cherry picked from commit fee778265064c290ae1852916ff47fcc0ab4a29d)

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Co-authored-by: Christian Marangi <ansuelsmth@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Lib/test/test_hashlib.py