Skip to content

Commit 8bb0b5b

Browse files
Carreaugpshead
authored andcommitted
bpo-33604: Remove Pending from hmac Deprecation warning. (GH-7062)
bpo-33604: Bump removal notice from 3.6 to 3.8 and change PendingDeprecationWarning to DeprecationWarning as we had intended to do earlier...
1 parent e8eb6cb commit 8bb0b5b

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

Doc/library/hmac.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This module implements the HMAC algorithm as described by :rfc:`2104`.
2727
Parameter *msg* can be of any type supported by :mod:`hashlib`.
2828
Parameter *digestmod* can be the name of a hash algorithm.
2929

30-
.. deprecated:: 3.4
30+
.. deprecated-removed:: 3.4 3.8
3131
MD5 as implicit default digest for *digestmod* is deprecated.
3232

3333

Lib/hmac.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ def __init__(self, key, msg = None, digestmod = None):
3939
A hashlib constructor returning a new hash object. *OR*
4040
A hash name suitable for hashlib.new().
4141
Defaults to hashlib.md5.
42-
Implicit default to hashlib.md5 is deprecated and will be
43-
removed in Python 3.6.
42+
Implicit default to hashlib.md5 is deprecated since Python
43+
3.4 and will be removed in Python 3.8.
4444
4545
Note: key and msg must be a bytes or bytearray objects.
4646
"""
@@ -50,7 +50,9 @@ def __init__(self, key, msg = None, digestmod = None):
5050

5151
if digestmod is None:
5252
_warnings.warn("HMAC() without an explicit digestmod argument "
53-
"is deprecated.", PendingDeprecationWarning, 2)
53+
"is deprecated since Python 3.4, and will be removed "
54+
"in 3.8",
55+
DeprecationWarning, 2)
5456
digestmod = _hashlib.md5
5557

5658
if callable(digestmod):

Lib/test/test_hmac.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def ignore_warning(func):
1212
def wrapper(*args, **kwargs):
1313
with warnings.catch_warnings():
1414
warnings.filterwarnings("ignore",
15-
category=PendingDeprecationWarning)
15+
category=DeprecationWarning)
1616
return func(*args, **kwargs)
1717
return wrapper
1818

@@ -303,7 +303,7 @@ def digest(self):
303303
self.fail('Expected warning about small block_size')
304304

305305
def test_with_digestmod_warning(self):
306-
with self.assertWarns(PendingDeprecationWarning):
306+
with self.assertWarns(DeprecationWarning):
307307
key = b"\x0b" * 16
308308
data = b"Hi There"
309309
digest = "9294727A3638BB1C13F48EF8158BFC9D"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update HMAC md5 default to a DeprecationWarning, bump removal to 3.8.

0 commit comments

Comments
 (0)