Author: Philip Jenvey <pjen...@underboss.org> Branch: py3k Changeset: r48980:0357086d2dc0 Date: 2011-11-08 18:08 -0800 http://bitbucket.org/pypy/pypy/changeset/0357086d2dc0/
Log: fix bytes' repr diff --git a/pypy/objspace/std/stringobject.py b/pypy/objspace/std/stringobject.py --- a/pypy/objspace/std/stringobject.py +++ b/pypy/objspace/std/stringobject.py @@ -897,8 +897,9 @@ def string_escape_encode(s, quote): - buf = StringBuilder(len(s) + 2) + buf = StringBuilder(len(s) + 3) + buf.append('b') buf.append(quote) startslice = 0 diff --git a/pypy/objspace/std/test/test_stringobject.py b/pypy/objspace/std/test/test_stringobject.py --- a/pypy/objspace/std/test/test_stringobject.py +++ b/pypy/objspace/std/test/test_stringobject.py @@ -618,23 +618,23 @@ assert l == [52, 50] def test_repr(self): - assert repr(b"") =="''" - assert repr(b"a") =="'a'" - assert repr(b"'") =='"\'"' - assert repr(b"\'") =="\"\'\"" - assert repr(b"\"") =='\'"\'' - assert repr(b"\t") =="'\\t'" - assert repr(b"\\") =="'\\\\'" - assert repr(b'') =="''" - assert repr(b'a') =="'a'" - assert repr(b'"') =="'\"'" - assert repr(b'\'') =='"\'"' - assert repr(b'\"') =="'\"'" - assert repr(b'\t') =="'\\t'" - assert repr(b'\\') =="'\\\\'" - assert repr(b"'''\"") =='\'\\\'\\\'\\\'"\'' - assert repr(b"\x13") =="'\\x13'" - assert repr(b"\x02") =="'\\x02'" + assert repr(b"") =="b''" + assert repr(b"a") =="b'a'" + assert repr(b"'") =='b"\'"' + assert repr(b"\'") =="b\"\'\"" + assert repr(b"\"") =='b\'"\'' + assert repr(b"\t") =="b'\\t'" + assert repr(b"\\") =="b'\\\\'" + assert repr(b'') =="b''" + assert repr(b'a') =="b'a'" + assert repr(b'"') =="b'\"'" + assert repr(b'\'') =='b"\'"' + assert repr(b'\"') =="b'\"'" + assert repr(b'\t') =="b'\\t'" + assert repr(b'\\') =="b'\\\\'" + assert repr(b"'''\"") =='b\'\\\'\\\'\\\'"\'' + assert repr(b"\x13") =="b'\\x13'" + assert repr(b"\x02") =="b'\\x02'" def test_contains(self): assert b'' in b'abc' _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit