File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 4040openssl_hashlib = import_fresh_module ('hashlib' , fresh = ['_hashlib' ])
4141
4242try :
43- from _hashlib import HASH
43+ import _hashlib
4444except ImportError :
45- HASH = None
46-
47- try :
48- from _hashlib import HASHXOF , openssl_md_meth_names , get_fips_mode
49- except ImportError :
50- HASHXOF = None
51- openssl_md_meth_names = frozenset ()
52-
45+ _hashlib = None
46+ # The extension module may exist but only define some of these. gh-141907
47+ HASH = getattr (_hashlib , 'HASH' , None )
48+ HASHXOF = getattr (_hashlib , 'HASHXOF' , None )
49+ openssl_md_meth_names = getattr (_hashlib , 'openssl_md_meth_names' , frozenset ())
50+ get_fips_mode = getattr (_hashlib , 'get_fips_mode' , None )
51+ if not get_fips_mode :
5352 def get_fips_mode ():
5453 return 0
5554
You can’t perform that action at this time.
0 commit comments