Author: Edd Barrett <vex...@gmail.com>
Branch: 
Changeset: r77837:131622d03fbe
Date: 2015-06-03 17:54 +0100
http://bitbucket.org/pypy/pypy/changeset/131622d03fbe/

Log:    Backed out changeset 5cf9f578ca18

        This broke translation on our debian 8 machine.

        I have tried setting various different LC_ALL/LC_CTYPE values, but
        these seem to have no effect.

        17:01 < fijal> ebarrett: well then rollback with an explanation
        17:01 < fijal> ebarrett: leaving build broken is not a good idea

        Translation error follows:

        [translation:info] File "/opt/pypy/rpython/annotator/unaryop.py",
        line 604, in method_decode [translation:info] raise
        AnnotatorError("Encoding %s not supported for strings" % (enc,))
        [translation:ERROR] AnnotatorError: [translation:ERROR]
        [translation:ERROR] Encoding latin1 not supported for strings
        [translation:ERROR] [translation:ERROR] [translation:ERROR] Occurred
        processing the following simple_call: [translation:ERROR]
        (AttributeError getting at the binding!) [translation:ERROR]
        v334 = simple_call(v333, ('latin1')) [translation:ERROR]
        [translation:ERROR] In <FunctionGraph of
        (pypy.objspace.std.newformat:529)Formatter._lit at 0x3724fa98>:
        [translation:ERROR] Happened at file
        /opt/pypy/pypy/objspace/std/newformat.py line 531
        [translation:ERROR] [translation:ERROR] ==> return
        s.decode("latin1") [translation:ERROR] [translation:ERROR] Known
        variable annotations: [translation:ERROR] v333 =
        SomeBuiltinMethod(analyser=<rpython.tool.descriptor.InstanceMethod
        object at 0x000000003802d910>, methodname='decode',
        s_self=SomeChar(const=' ', no_nul=True)) [translation:ERROR]
        [translation:ERROR] Processing block: [translation:ERROR] block@12
        is a <class 'rpython.flowspace.flowcontext.SpamBlock'>
        [translation:ERROR] in
        (pypy.objspace.std.newformat:529)Formatter._lit [translation:ERROR]
        containing the following operations: [translation:ERROR] v333
        = getattr(s_11, ('decode')) [translation:ERROR] v334 =
        simple_call(v333, ('latin1')) [translation:ERROR] --end--

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("latin1")
+                return s.decode("ascii")
             else:
                 return s
 
@@ -586,8 +586,8 @@
                 thousands = ""
                 grouping = "\xFF"    # special value to mean 'stop'
             if self.is_unicode:
-                self._loc_dec = dec.decode("latin1")
-                self._loc_thousands = thousands.decode("latin1")
+                self._loc_dec = dec.decode("ascii")
+                self._loc_thousands = thousands.decode("ascii")
             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("latin1")
+                    sign = spec.sign.decode("ascii")
                 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("latin1")
+                return as_str.decode("ascii")
             return as_str
 
         def _int_to_base(self, base, value):
             if base == 10:
                 s = str(value)
                 if self.is_unicode:
-                    return s.decode("latin1")
+                    return s.decode("ascii")
                 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("latin1")
+                digits = result.decode("ascii")
             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("latin1")
-                im_num = im_num.decode("latin1")
+                re_num = re_num.decode("ascii")
+                im_num = im_num.decode("ascii")
 
             #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

Reply via email to