[pypy-commit] pypy py3k: kill long's suffix support
pjenvey
noreply at buildbot.pypy.org
Fri Dec 14 00:36:17 CET 2012
Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r59415:6e758a21cc92
Date: 2012-12-13 15:05 -0800
http://bitbucket.org/pypy/pypy/changeset/6e758a21cc92/
Log: kill long's suffix support
diff --git a/pypy/objspace/std/strutil.py b/pypy/objspace/std/strutil.py
--- a/pypy/objspace/std/strutil.py
+++ b/pypy/objspace/std/strutil.py
@@ -131,13 +131,9 @@
@enforceargs(unicode, None, None)
def string_to_bigint(s, base=10, parser=None):
- """As string_to_int(), but ignores an optional 'l' or 'L' suffix
- and returns an rbigint."""
+ """As string_to_int() but returns an rbigint."""
if parser is None:
s = literal = strip_spaces(s)
- if (s.endswith(u'l') or s.endswith(u'L')) and base < 22:
- # in base 22 and above, 'L' is a valid digit! try: long('L',22)
- s = s[:-1]
p = NumberStringParser(s, literal, base, u'int')
else:
p = parser
diff --git a/pypy/objspace/std/test/test_longobject.py b/pypy/objspace/std/test/test_longobject.py
--- a/pypy/objspace/std/test/test_longobject.py
+++ b/pypy/objspace/std/test/test_longobject.py
@@ -325,6 +325,8 @@
assert type(b) is int
def test_long_from_unicode(self):
+ raises(ValueError, int, '123L')
+ assert int('L', 22) == 21
s = '\U0001D7CF\U0001D7CE' # 𝟏𝟎
assert int(s) == 10
More information about the pypy-commit
mailing list