Skip to content

Commit 9ace9af

Browse files
Guard _hahslib usage in test_hashlib.py
1 parent f079979 commit 9ace9af

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Lib/test/test_hashlib.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,10 @@ def test_clinic_signature(self):
274274
with self.assertWarnsRegex(DeprecationWarning,
275275
DEPRECATED_STRING_PARAMETER):
276276
hashlib.new(digest_name, string=b'')
277-
if self._hashlib:
277+
# when using a combination of libcrypto and interned hash
278+
# implementations, we need to make sure that _hashlib contains
279+
# the constructor we're testing
280+
if self._hashlib and digest_name in self._hashlib._constructors:
278281
self._hashlib.new(digest_name, b'')
279282
self._hashlib.new(digest_name, data=b'')
280283
with self.assertWarnsRegex(DeprecationWarning,

0 commit comments

Comments
 (0)