Skip to content

Commit f57cdac

Browse files
committed
Clean up the usedforsecurity change
1 parent 673ece7 commit f57cdac

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

cacheops/utils.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,9 @@ def repl(m):
144144

145145
class md5:
146146
def __init__(self, s=None):
147-
md5_kwargs = {}
148-
149147
# set usedforsecurity for FIPS compliance
150-
# usedforsecurity was introduced in 3.9
151-
# this is for backwards compatibility
152-
pyversion = sys.version_info
153-
if (pyversion.major == 3 and pyversion.minor >= 9) or pyversion.major > 3:
154-
md5_kwargs["usedforsecurity"] = False
155-
156-
self.md5 = hashlib.md5(**md5_kwargs)
148+
kwargs = {'usedforsecurity': False} if sys.version_info >= (3, 9) else {}
149+
self.md5 = hashlib.md5(**kwargs)
157150
if s is not None:
158151
self.update(s)
159152

0 commit comments

Comments
 (0)