Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r77857:5d676752ae66 Date: 2015-06-04 13:17 +0100 http://bitbucket.org/pypy/pypy/changeset/5d676752ae66/
Log: Redo 5cf9f578ca18 (which I only noticed by luck was reverted...). As shown one line before the crash, "latin-1" is the only RPython- sanctioned spelling, not "latin1". 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 @@ -528,7 +528,7 @@ def _lit(self, s): if self.is_unicode: - return s.decode("ascii") + return s.decode("latin-1") else: return s @@ -586,8 +586,8 @@ thousands = "" grouping = "\xFF" # special value to mean 'stop' if self.is_unicode: - self._loc_dec = dec.decode("ascii") - self._loc_thousands = thousands.decode("ascii") + self._loc_dec = dec.decode("latin-1") + self._loc_thousands = thousands.decode("latin-1") else: self._loc_dec = dec self._loc_thousands = thousands @@ -725,7 +725,7 @@ out.append_multiple_char(fill_char[0], spec.n_lpadding) if spec.n_sign: if self.is_unicode: - sign = spec.sign.decode("ascii") + sign = spec.sign.decode("latin-1") else: sign = spec.sign out.append(sign) @@ -828,14 +828,14 @@ prefix = "0x" as_str = value.format(LONG_DIGITS[:base], prefix) if self.is_unicode: - return as_str.decode("ascii") + return as_str.decode("latin-1") return as_str def _int_to_base(self, base, value): if base == 10: s = str(value) if self.is_unicode: - return s.decode("ascii") + return s.decode("latin-1") return s # This part is slow. negative = value < 0 @@ -954,7 +954,7 @@ have_dec_point, to_remainder = self._parse_number(result, to_number) n_remainder = len(result) - to_remainder if self.is_unicode: - digits = result.decode("ascii") + digits = result.decode("latin-1") else: digits = result spec = self._calc_num_width(0, sign, to_number, n_digits, @@ -1059,8 +1059,8 @@ to_imag_number) if self.is_unicode: - re_num = re_num.decode("ascii") - im_num = im_num.decode("ascii") + re_num = re_num.decode("latin-1") + im_num = im_num.decode("latin-1") #set remainder, in CPython _parse_number sets this #using n_re_digits causes tests to fail _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit