Author: Matti Picus <[email protected]>
Branch: unicode-utf8-py3
Changeset: r95675:c01df448bea6
Date: 2019-01-19 22:14 +0200
http://bitbucket.org/pypy/pypy/changeset/c01df448bea6/
Log: merge unicode-utf8 into branch
diff --git a/pypy/objspace/std/newformat.py b/pypy/objspace/std/newformat.py
--- a/pypy/objspace/std/newformat.py
+++ b/pypy/objspace/std/newformat.py
@@ -751,7 +751,7 @@
to_remainder, upper, grouped_digits=None):
out = self._builder()
if spec.n_lpadding:
- out.append_multiple_char(fill_char[0], spec.n_lpadding)
+ out.append_multiple_char(fill_char, spec.n_lpadding)
if spec.n_sign:
sign = self._lit(spec.sign)
out.append(sign)
@@ -761,7 +761,7 @@
pref = self._upcase_string(pref)
out.append(pref)
if spec.n_spadding:
- out.append_multiple_char(fill_char[0], spec.n_spadding)
+ out.append_multiple_char(fill_char, spec.n_spadding)
if spec.n_digits != 0:
if self._loc_thousands:
if grouped_digits is not None:
@@ -781,7 +781,7 @@
if spec.n_remainder:
out.append(num[to_remainder:])
if spec.n_rpadding:
- out.append_multiple_char(fill_char[0], spec.n_rpadding)
+ out.append_multiple_char(fill_char, spec.n_rpadding)
#if complex, need to call twice - just retun the buffer
return out.build()
diff --git a/pypy/objspace/std/test/test_unicodeobject.py
b/pypy/objspace/std/test/test_unicodeobject.py
--- a/pypy/objspace/std/test/test_unicodeobject.py
+++ b/pypy/objspace/std/test/test_unicodeobject.py
@@ -1130,6 +1130,8 @@
def test_format_repeat(self):
assert format(u"abc", u"z<5") == u"abczz"
assert format(u"abc", u"\u2007<5") == u"abc\u2007\u2007"
+ #CPython2 raises UnicodeEncodeError
+ assert format(123, u"\u2007<5") == u"123\u2007\u2007"
def test_formatting_unicode__repr__(self):
# Printable character
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit