[pypy-commit] pypy py3k: Python 3 syntax changes in hashlib
dusty
noreply at buildbot.pypy.org
Tue Mar 13 06:40:59 CET 2012
Author: Dusty Phillips <dusty at buchuki.com>
Branch: py3k
Changeset: r53410:712cc0232ea1
Date: 2012-03-12 17:18 -0700
http://bitbucket.org/pypy/pypy/changeset/712cc0232ea1/
Log: Python 3 syntax changes in hashlib
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
@@ -33,7 +33,7 @@
try:
w_name = state.space.wrap(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
@@ -72,16 +72,16 @@
"4effe5d7a31879b8b7a10fd2f544c4ca268ecc6793923583"),
}
import _hashlib
- test_string = "Nobody inspects the spammish repetition"
+ test_string = b"Nobody inspects the spammish repetition"
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
+ assert got and type(got) is bytes and len(got) % 2 == 0
got.decode('hex')
if expected is not None:
assert got == expected
More information about the pypy-commit
mailing list