Author: Philip Jenvey <[email protected]>
Branch:
Changeset: r69731:b58eb7873100
Date: 2014-03-05 11:38 -0800
http://bitbucket.org/pypy/pypy/changeset/b58eb7873100/
Log: backout 307818c61207 & 0e0d08198110, this is no longer needed for
py3k
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(fromstr2), p25, 16, descr=<Callr . ri EF=3>)
+ p93 = call(ConstClass(fromstr), 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/longobject.py b/pypy/objspace/std/longobject.py
--- a/pypy/objspace/std/longobject.py
+++ b/pypy/objspace/std/longobject.py
@@ -542,7 +542,7 @@
def _string_to_w_long(space, w_longtype, w_source, string, base=10):
try:
- bigint = rbigint.fromstr2(string, base)
+ bigint = rbigint.fromstr(string, base)
except ParseStringError as e:
from pypy.objspace.std.intobject 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
@@ -254,28 +254,19 @@
@staticmethod
@jit.elidable
- def fromstr(s, base=0, ignore_l_suffix=False, fname='long'):
- """As string_to_int(), but optionally ignores an optional 'l' or
- 'L' suffix and returns an rbigint.
- """
+ def fromstr(s, base=0):
+ """As string_to_int(), but ignores an optional 'l' or 'L' suffix
+ and returns an rbigint."""
from rpython.rlib.rstring import NumberStringParser, \
strip_spaces
s = literal = strip_spaces(s)
- if (not ignore_l_suffix and (s.endswith('l') or s.endswith('L')) and
- base < 22):
+ if (s.endswith('l') or s.endswith('L')) and base < 22:
# in base 22 and above, 'L' is a valid digit! try: long('L',22)
s = s[:-1]
- parser = NumberStringParser(s, literal, base, fname)
+ parser = NumberStringParser(s, literal, base, 'long')
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
@@ -214,19 +214,13 @@
from rpython.rlib.rstring import ParseStringError
assert rbigint.fromstr('123L').tolong() == 123
assert rbigint.fromstr('123L ').tolong() == 123
- py.test.raises(ParseStringError, rbigint.fromstr, '123L ',
- ignore_l_suffix=True)
py.test.raises(ParseStringError, rbigint.fromstr, 'L')
py.test.raises(ParseStringError, rbigint.fromstr, 'L ')
- e = py.test.raises(ParseStringError, rbigint.fromstr, 'L ',
- fname='int')
- assert 'int()' in e.value.msg
assert rbigint.fromstr('123L', 4).tolong() == 27
assert rbigint.fromstr('123L', 30).tolong() == 27000 + 1800 + 90 + 21
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