[pypy-svn] r58736 - in pypy/branch/2.5-merge/pypy/objspace/std: . test
jlg at codespeak.net
jlg at codespeak.net
Tue Oct 7 14:25:51 CEST 2008
Author: jlg
Date: Tue Oct 7 14:25:50 2008
New Revision: 58736
Modified:
pypy/branch/2.5-merge/pypy/objspace/std/strutil.py
pypy/branch/2.5-merge/pypy/objspace/std/test/test_intobject.py
pypy/branch/2.5-merge/pypy/objspace/std/test/test_strutil.py
Log:
(arigo, jlg) fix for int overflow cornercase
Modified: pypy/branch/2.5-merge/pypy/objspace/std/strutil.py
==============================================================================
--- pypy/branch/2.5-merge/pypy/objspace/std/strutil.py (original)
+++ pypy/branch/2.5-merge/pypy/objspace/std/strutil.py Tue Oct 7 14:25:50 2008
@@ -101,12 +101,11 @@
while True:
digit = p.next_digit()
if digit == -1:
- try:
- result = ovfcheck(p.sign * result)
- except OverflowError:
- raise ParseStringOverflowError(p)
- else:
- return result
+ return result
+
+ if p.sign == -1:
+ digit = -digit
+
try:
result = ovfcheck(result * base)
result = ovfcheck(result + digit)
Modified: pypy/branch/2.5-merge/pypy/objspace/std/test/test_intobject.py
==============================================================================
--- pypy/branch/2.5-merge/pypy/objspace/std/test/test_intobject.py (original)
+++ pypy/branch/2.5-merge/pypy/objspace/std/test/test_intobject.py Tue Oct 7 14:25:50 2008
@@ -323,7 +323,6 @@
raises(TypeError, int, '5', '9')
def test_int_largenums(self):
- py.test.skip("in-progress")
import sys
for x in [-sys.maxint-1, -1, sys.maxint]:
y = int(str(x))
Modified: pypy/branch/2.5-merge/pypy/objspace/std/test/test_strutil.py
==============================================================================
--- pypy/branch/2.5-merge/pypy/objspace/std/test/test_strutil.py (original)
+++ pypy/branch/2.5-merge/pypy/objspace/std/test/test_strutil.py Tue Oct 7 14:25:50 2008
@@ -92,7 +92,6 @@
str(sys.maxint*17))
def test_string_to_int_not_overflow(self):
- py.test.skip("in-progress")
import sys
for x in [-sys.maxint-1, sys.maxint]:
y = string_to_int(str(x))
More information about the Pypy-commit
mailing list