Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r69057:0e0d08198110
Date: 2014-02-03 11:37 +0100
http://bitbucket.org/pypy/pypy/changeset/0e0d08198110/

Log:    Fix for 307818c61207 in test_pypy_c

diff --git a/pypy/module/pypyjit/test_pypy_c/test_string.py 
b/pypy/module/pypyjit/test_pypy_c/test_string.py
--- a/pypy/module/pypyjit/test_pypy_c/test_string.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_string.py
@@ -80,7 +80,7 @@
             i23 = strgetitem(p10, i19)
             p25 = newstr(1)
             strsetitem(p25, 0, i23)
-            p93 = call(ConstClass(fromstr), p25, 16, descr=<Callr . ri EF=3>)
+            p93 = call(ConstClass(fromstr2), p25, 16, descr=<Callr . ri EF=3>)
             guard_no_exception(descr=...)
             i94 = call(ConstClass(rbigint.toint), p93, descr=<Calli . r EF=3>)
             guard_no_exception(descr=...)
diff --git a/pypy/objspace/std/longtype.py b/pypy/objspace/std/longtype.py
--- a/pypy/objspace/std/longtype.py
+++ b/pypy/objspace/std/longtype.py
@@ -78,7 +78,7 @@
 
 def string_to_w_long(space, w_longtype, w_source, string, base=10):
     try:
-        bigint = rbigint.fromstr(string, base)
+        bigint = rbigint.fromstr2(string, base)
     except ParseStringError as e:
         from pypy.objspace.std.inttype import wrap_parsestringerror
         raise wrap_parsestringerror(space, e, w_source)
diff --git a/rpython/rlib/rbigint.py b/rpython/rlib/rbigint.py
--- a/rpython/rlib/rbigint.py
+++ b/rpython/rlib/rbigint.py
@@ -269,6 +269,13 @@
         return rbigint._from_numberstring_parser(parser)
 
     @staticmethod
+    @jit.elidable
+    def fromstr2(s, base=0):
+        """A sub-version of fromstr(), already elidable to be JIT-called
+        with only two arguments."""
+        return rbigint.fromstr(s, base)
+
+    @staticmethod
     def _from_numberstring_parser(parser):
         return parse_digit_string(parser)
 
diff --git a/rpython/rlib/test/test_rbigint.py 
b/rpython/rlib/test/test_rbigint.py
--- a/rpython/rlib/test/test_rbigint.py
+++ b/rpython/rlib/test/test_rbigint.py
@@ -226,6 +226,7 @@
         assert rbigint.fromstr('123L', 22).tolong() == 10648 + 968 + 66 + 21
         assert rbigint.fromstr('123L', 21).tolong() == 441 + 42 + 3
         assert rbigint.fromstr('1891234174197319').tolong() == 1891234174197319
+        assert rbigint.fromstr2('123L', 4).tolong() == 27
 
     def test_from_numberstring_parser(self):
         from rpython.rlib.rstring import NumberStringParser
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to