Skip to content

Commit 8ac8aa0

Browse files
committed
only use default GIL_MINSIZE if none can be found
1 parent f0d1664 commit 8ac8aa0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Lib/test/test_hashlib.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import warnings
2121
from test import support
2222
from test.support import _4G, bigmemtest
23+
from test.support import hashlib_helper
2324
from test.support.import_helper import import_fresh_module, import_module
2425
from test.support import requires_resource
2526
from test.support import threading_helper
@@ -96,16 +97,16 @@ def read_vectors(hash_name):
9697

9798

9899
def find_gil_minsize(*modules_names, default=2048):
99-
gil_minsize = default
100+
sizes = []
100101
for module_name in modules_names:
101102
if SKIP_SHA3 and module_name == '_sha3':
102103
continue
103104
try:
104105
module = importlib.import_module(module_name)
105106
except ImportError:
106107
continue
107-
gil_minsize = max(gil_minsize, module._GIL_MINSIZE)
108-
return gil_minsize
108+
sizes.append(module._GIL_MINSIZE)
109+
return max(sizes, default=default)
109110

110111

111112
class HashLibTestCase(unittest.TestCase):

0 commit comments

Comments
 (0)