Author: Brian Kearns <[email protected]>
Branch: stdlib-2.7.6
Changeset: r69611:9268939caf10
Date: 2014-03-02 06:42 -0500
http://bitbucket.org/pypy/pypy/changeset/9268939caf10/

Log:    fix translation

diff --git a/pypy/objspace/std/formatting.py b/pypy/objspace/std/formatting.py
--- a/pypy/objspace/std/formatting.py
+++ b/pypy/objspace/std/formatting.py
@@ -161,7 +161,6 @@
         const = str
 
     class StringFormatter(BaseStringFormatter):
-
         def __init__(self, space, fmt, values_w, w_valuedict):
             BaseStringFormatter.__init__(self, space, values_w, w_valuedict)
             self.fmt = fmt    # either a string or a unicode
@@ -218,7 +217,7 @@
 
             self.peel_flags()
 
-            self.width = self.peel_num('width', self.space.int_w, sys.maxint)
+            self.width = self.peel_num('width', sys.maxint)
             if self.width < 0:
                 # this can happen:  '%*s' % (-5, "hi")
                 self.f_ljust = True
@@ -226,7 +225,7 @@
 
             if self.peekchr() == '.':
                 self.forward()
-                self.prec = self.peel_num('prec', self.space.c_int_w, INT_MAX)
+                self.prec = self.peel_num('prec', INT_MAX)
                 if self.prec < 0:
                     self.prec = 0    # this can happen:  '%.*f' % (-5, 3)
             else:
@@ -264,13 +263,18 @@
 
         # Same as getmappingkey
         @jit.unroll_safe
-        def peel_num(self, name, conv_w, maxval):
+        def peel_num(self, name, maxval):
             space = self.space
             c = self.peekchr()
             if c == '*':
                 self.forward()
                 w_value = self.nextinputvalue()
-                return conv_w(w_value)
+                if name == 'width':
+                    return space.int_w(w_value)
+                elif name == 'prec':
+                    return space.c_int_w(w_value)
+                else:
+                    assert False
             result = 0
             while True:
                 digit = ord(c) - ord('0')
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to