We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d46c84e commit d32d30bCopy full SHA for d32d30b
zxcvbn/matching.py
@@ -23,10 +23,9 @@ def get_ranked_dictionaries():
23
# Do the expensive import here only
24
from zxcvbn.frequency_lists import FREQUENCY_LISTS
25
26
- # Build the dictionary once
27
- RANKED_DICTIONARIES = {}
28
- for name, lst in FREQUENCY_LISTS.items():
29
- RANKED_DICTIONARIES[name] = build_ranked_dict(lst)
+ # Build in local scope before adding to global scope for thread safety
+ built_dict = {name: build_ranked_dict(lst) for name, lst in FREQUENCY_LISTS.items()}
+ RANKED_DICTIONARIES = built_dict
30
return RANKED_DICTIONARIES
31
32
0 commit comments