@@ -264,7 +264,10 @@ def test_clinic_signature(self):
264
264
hashlib .new (digest_name , b'' )
265
265
hashlib .new (digest_name , data = b'' )
266
266
hashlib .new (digest_name , string = b'' )
267
- if self ._hashlib :
267
+ # Make sure that _hashlib contains the constructor
268
+ # to test when using a combination of libcrypto and
269
+ # interned hash implementations.
270
+ if self ._hashlib and digest_name in self ._hashlib ._constructors :
268
271
self ._hashlib .new (digest_name , b'' )
269
272
self ._hashlib .new (digest_name , data = b'' )
270
273
self ._hashlib .new (digest_name , string = b'' )
@@ -316,7 +319,8 @@ def test_clinic_signature_errors(self):
316
319
with self .subTest (digest_name , args = args , kwds = kwds ):
317
320
with self .assertRaisesRegex (TypeError , errmsg ):
318
321
hashlib .new (digest_name , * args , ** kwds )
319
- if self ._hashlib :
322
+ if (self ._hashlib and
323
+ digest_name in self ._hashlib ._constructors ):
320
324
with self .assertRaisesRegex (TypeError , errmsg ):
321
325
self ._hashlib .new (digest_name , * args , ** kwds )
322
326
0 commit comments