[pypy-commit] pypy py3k: Python 3 exception syntax

dusty noreply at buildbot.pypy.org
Tue Mar 13 06:41:01 CET 2012


Author: Dusty Phillips <dusty at buchuki.com>
Branch: py3k
Changeset: r53411:c89478c35d01
Date: 2012-03-12 21:38 -0700
http://bitbucket.org/pypy/pypy/changeset/c89478c35d01/

Log:	Python 3 exception syntax

diff --git a/pypy/module/_hashlib/interp_hashlib.py b/pypy/module/_hashlib/interp_hashlib.py
--- a/pypy/module/_hashlib/interp_hashlib.py
+++ b/pypy/module/_hashlib/interp_hashlib.py
@@ -31,9 +31,9 @@
     if obj_name[0].c_alias:
         return
     try:
-        w_name = state.space.wrap(rffi.charp2str(obj_name[0].c_name))
+        w_name = state.space.wrapbytes(rffi.charp2str(obj_name[0].c_name))
         state.space.call_method(state.w_meth_names, "add", w_name)
-    except OperationError, e:
+    except OperationError as e:
         state.w_error = e
 
 # XXX make it threadlocal?
diff --git a/pypy/module/_hashlib/test/test_hashlib.py b/pypy/module/_hashlib/test/test_hashlib.py
--- a/pypy/module/_hashlib/test/test_hashlib.py
+++ b/pypy/module/_hashlib/test/test_hashlib.py
@@ -76,12 +76,11 @@
         for hash_name, expected in sorted(expected_results.items()):
             try:
                 m = _hashlib.new(hash_name)
-            except ValueError, e:
-                print 'skipped %s: %s' % (hash_name, e)
+            except ValueError as e:
+                print('skipped %s: %s' % (hash_name, e))
                 continue
             m.update(test_string)
             got = m.hexdigest()
             assert got and type(got) is str and len(got) % 2 == 0
-            got.decode('hex')
             if expected is not None:
                 assert got == expected


More information about the pypy-commit mailing list