We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3ea0582 commit e2df647Copy full SHA for e2df647
Lib/smtplib.py
@@ -179,12 +179,16 @@ def _fix_eols(data):
179
return re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data)
180
181
182
-# CRAM-MD5 may be supported by the server but not by us
183
-# if HMAC-MD5 is not supported.
+# Use unbounded LRU cache instead of global variable to ease mocking.
184
@functools.cache
185
def _have_cram_md5_support():
+ """Check if CRAM-MD5 is supported by the host.
186
+
187
+ Note that CRAM-MD5 may be supported by the server
188
+ but not by the client if HMAC-MD5 is not supported.
189
+ """
190
try:
- hmac.new(b'', b'', 'md5').hexdigest()
191
+ hmac.digest(b'', b'', 'md5')
192
return True
193
except ValueError:
194
return False
0 commit comments