Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Checkins

cpython (merge 3.2 -> default): Consistently raise a TypeError when a non str is passed to hashlib.new

 

 

Python checkins RSS feed   Index | Next | Previous | View Threaded


python-checkins at python

Jul 21, 2012, 9:23 PM

Post #1 of 1 (35 views)
Permalink
cpython (merge 3.2 -> default): Consistently raise a TypeError when a non str is passed to hashlib.new

http://hg.python.org/cpython/rev/e683084c8bb9
changeset: 78236:e683084c8bb9
parent: 78234:a636f365d815
parent: 78235:c97cfe04880f
user: Gregory P. Smith <greg [at] krypto>
date: Sat Jul 21 21:20:44 2012 -0700
summary:
Consistently raise a TypeError when a non str is passed to hashlib.new
regardless of which of the two implementations of new is used.

files:
Lib/hashlib.py | 2 +-
Lib/test/test_hashlib.py | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Lib/hashlib.py b/Lib/hashlib.py
--- a/Lib/hashlib.py
+++ b/Lib/hashlib.py
@@ -88,7 +88,7 @@
except ImportError:
pass # no extension module, this hash is unsupported.

- raise ValueError('unsupported hash type %s' % name)
+ raise ValueError('unsupported hash type ' + name)


def __get_openssl_constructor(name):
diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
--- a/Lib/test/test_hashlib.py
+++ b/Lib/test/test_hashlib.py
@@ -133,6 +133,7 @@
sys.modules['_md5'] = _md5
else:
del sys.modules['_md5']
+ self.assertRaises(TypeError, get_builtin_constructor, 3)

def test_hexdigest(self):
for name in self.supported_hash_names:

--
Repository URL: http://hg.python.org/cpython

Python checkins RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.