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