From 9ace9afb24a8d213118ffaef6f210a138e73bf45 Mon Sep 17 00:00:00 2001 From: WillChilds-Klein Date: Mon, 16 Jun 2025 15:28:09 +0000 Subject: [PATCH 1/3] Guard _hahslib usage in test_hashlib.py --- Lib/test/test_hashlib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py index b83ae181718b7a..ff52e73100e373 100644 --- a/Lib/test/test_hashlib.py +++ b/Lib/test/test_hashlib.py @@ -274,7 +274,10 @@ def test_clinic_signature(self): with self.assertWarnsRegex(DeprecationWarning, DEPRECATED_STRING_PARAMETER): hashlib.new(digest_name, string=b'') - if self._hashlib: + # when using a combination of libcrypto and interned hash + # implementations, we need to make sure that _hashlib contains + # the constructor we're testing + if self._hashlib and digest_name in self._hashlib._constructors: self._hashlib.new(digest_name, b'') self._hashlib.new(digest_name, data=b'') with self.assertWarnsRegex(DeprecationWarning, From 1dda3b6cd757e69bb5819c8963a244d7e299b03d Mon Sep 17 00:00:00 2001 From: Will Childs-Klein Date: Mon, 16 Jun 2025 14:57:52 -0400 Subject: [PATCH 2/3] Update Lib/test/test_hashlib.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- Lib/test/test_hashlib.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py index ff52e73100e373..c9e348edab19f8 100644 --- a/Lib/test/test_hashlib.py +++ b/Lib/test/test_hashlib.py @@ -274,9 +274,9 @@ def test_clinic_signature(self): with self.assertWarnsRegex(DeprecationWarning, DEPRECATED_STRING_PARAMETER): hashlib.new(digest_name, string=b'') - # when using a combination of libcrypto and interned hash - # implementations, we need to make sure that _hashlib contains - # the constructor we're testing + # Make sure that _hashlib contains the constructor + # to test when using a combination of libcrypto and + # interned hash implementations. if self._hashlib and digest_name in self._hashlib._constructors: self._hashlib.new(digest_name, b'') self._hashlib.new(digest_name, data=b'') From 27ca72fa233eef0e1869a9a9fa7a8faf72d938f6 Mon Sep 17 00:00:00 2001 From: WillChilds-Klein Date: Fri, 20 Jun 2025 17:13:06 +0000 Subject: [PATCH 3/3] Update test_clinic_signature_errors --- Lib/test/test_hashlib.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py index c9e348edab19f8..24b833b1c0dc14 100644 --- a/Lib/test/test_hashlib.py +++ b/Lib/test/test_hashlib.py @@ -331,7 +331,8 @@ def test_clinic_signature_errors(self): with self.subTest(digest_name, args=args, kwds=kwds): with self.assertRaisesRegex(TypeError, errmsg): hashlib.new(digest_name, *args, **kwds) - if self._hashlib: + if (self._hashlib and + digest_name in self._hashlib._constructors): with self.assertRaisesRegex(TypeError, errmsg): self._hashlib.new(digest_name, *args, **kwds) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy