[pypy-svn] r77422 - pypy/branch/fast-forward/lib_pypy

afa at codespeak.net afa at codespeak.net
Tue Sep 28 00:26:48 CEST 2010


Author: afa
Date: Tue Sep 28 00:26:47 2010
New Revision: 77422

Modified:
   pypy/branch/fast-forward/lib_pypy/hashlib.py
Log:
expose hashlib.algorithms


Modified: pypy/branch/fast-forward/lib_pypy/hashlib.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/hashlib.py	(original)
+++ pypy/branch/fast-forward/lib_pypy/hashlib.py	Tue Sep 28 00:26:47 2010
@@ -108,14 +108,12 @@
 
 new = __hash_new
 
+algorithms = ['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512']
+
 def __getfunc(name):
     def new(string=''):
         return __hash_new(name, string)
     return new
 
-md5 = __getfunc('md5')
-sha1 = __getfunc('sha1')
-sha224 = __getfunc('sha224')
-sha256 = __getfunc('sha256')
-sha384 = __getfunc('sha384')
-sha512 = __getfunc('sha512')
+for __name in algorithms:
+    globals()[name] = __getfunc(__name)



More information about the Pypy-commit mailing list