mirror of
https://github.com/python/cpython.git
synced 2025-11-10 10:32:04 +00:00
[3.13] gh-135571: Guard _hashlib usage in test_hashlib.py (GH-135572) (#136041)
(cherry picked from commit 065194c1a9)
Co-authored-by: Will Childs-Klein <willck93@gmail.com>
This commit is contained in:
parent
ad1b0c942d
commit
d3bcecdcdb
1 changed files with 6 additions and 2 deletions
|
|
@ -264,7 +264,10 @@ def test_clinic_signature(self):
|
|||
hashlib.new(digest_name, b'')
|
||||
hashlib.new(digest_name, data=b'')
|
||||
hashlib.new(digest_name, string=b'')
|
||||
if self._hashlib:
|
||||
# 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'')
|
||||
self._hashlib.new(digest_name, string=b'')
|
||||
|
|
@ -316,7 +319,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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue