File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -279,7 +279,10 @@ def test_clinic_signature(self):
279279 with self .assertWarnsRegex (DeprecationWarning ,
280280 DEPRECATED_STRING_PARAMETER ):
281281 hashlib .new (digest_name , string = b'' )
282- if self ._hashlib :
282+ # Make sure that _hashlib contains the constructor
283+ # to test when using a combination of libcrypto and
284+ # interned hash implementations.
285+ if self ._hashlib and digest_name in self ._hashlib ._constructors :
283286 self ._hashlib .new (digest_name , b'' )
284287 self ._hashlib .new (digest_name , data = b'' )
285288 with self .assertWarnsRegex (DeprecationWarning ,
@@ -333,7 +336,8 @@ def test_clinic_signature_errors(self):
333336 with self .subTest (digest_name , args = args , kwds = kwds ):
334337 with self .assertRaisesRegex (TypeError , errmsg ):
335338 hashlib .new (digest_name , * args , ** kwds )
336- if self ._hashlib :
339+ if (self ._hashlib and
340+ digest_name in self ._hashlib ._constructors ):
337341 with self .assertRaisesRegex (TypeError , errmsg ):
338342 self ._hashlib .new (digest_name , * args , ** kwds )
339343
You can’t perform that action at this time.
0 commit comments