Author: Amaury Forgeot d'Arc <amaur...@gmail.com> Branch: py3.5 Changeset: r88040:879102e55ef2 Date: 2016-11-01 17:55 +0100 http://bitbucket.org/pypy/pypy/changeset/879102e55ef2/
Log: Fix error messages to match CPython 3.5 diff --git a/pypy/module/_codecs/interp_codecs.py b/pypy/module/_codecs/interp_codecs.py --- a/pypy/module/_codecs/interp_codecs.py +++ b/pypy/module/_codecs/interp_codecs.py @@ -689,7 +689,7 @@ return errorchar raise oefmt(space.w_TypeError, - "character mapping must return integer, None or unicode") + "character mapping must return integer, None or str") class Charmap_Encode: def __init__(self, space, w_mapping): @@ -722,7 +722,7 @@ return errorchar raise oefmt(space.w_TypeError, - "character mapping must return integer, None or str") + "character mapping must return integer, bytes or None, not str") @unwrap_spec(string='bufferstr', errors='str_or_None') diff --git a/pypy/module/_codecs/test/test_codecs.py b/pypy/module/_codecs/test/test_codecs.py --- a/pypy/module/_codecs/test/test_codecs.py +++ b/pypy/module/_codecs/test/test_codecs.py @@ -112,7 +112,7 @@ assert charmap_decode(b'xxx\xff', 'strict', map) == ('xxx\xff', 4) exc = raises(TypeError, charmap_decode, b'\xff', "strict", {0xff: b'a'}) - assert str(exc.value) == "character mapping must return integer, None or unicode" + assert str(exc.value) == "character mapping must return integer, None or str" raises(TypeError, charmap_decode, b'\xff', "strict", {0xff: 0x110000}) assert (charmap_decode(b"\x00\x01\x02", "strict", {0: 0x10FFFF, 1: ord('b'), 2: ord('c')}) == @@ -687,7 +687,7 @@ exc = raises(TypeError, codecs.charmap_encode, u'\xff', "replace", {0xff: 300}) assert str(exc.value) == 'character mapping must be in range(256)' exc = raises(TypeError, codecs.charmap_encode, u'\xff', "replace", {0xff: u'a'}) - assert str(exc.value) == 'character mapping must return integer, None or str' + assert str(exc.value) == 'character mapping must return integer, bytes or None, not str' raises(UnicodeError, codecs.charmap_encode, u"\xff", "replace", {0xff: None}) def test_charmap_encode_replace(self): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit