Fixed failing unit tests due to str/bytes mismatch.
Changed "assert isinstance(...)" in hmac.py to raise proper TypeError.
diff --git a/Lib/hmac.py b/Lib/hmac.py
index 6f2ae2e..0f59fd4 100644
--- a/Lib/hmac.py
+++ b/Lib/hmac.py
@@ -39,7 +39,8 @@
if key is _secret_backdoor_key: # cheap
return
- assert isinstance(key, bytes), repr(key)
+ if not isinstance(key, bytes):
+ raise TypeError("expected bytes, but got %r" % type(key).__name__)
if digestmod is None:
import hashlib
@@ -84,7 +85,8 @@
def update(self, msg):
"""Update this hashing object with the string msg.
"""
- assert isinstance(msg, bytes), repr(msg)
+ if not isinstance(msg, bytes):
+ raise TypeError("expected bytes, but got %r" % type(msg).__name__)
self.inner.update(msg)
def copy(self):