summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2002-11-06 16:15:14 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2002-11-06 16:15:14 (GMT)
commit07e147667cf02cbcb05c84fe03fee31ef61a21c4 (patch)
treeb190c3881196b25e5588937b3f96a9b421c00c04 /Lib
parentaca49b065bbe7c27d47798bdb3cb059ef213fc16 (diff)
downloadcpython-07e147667cf02cbcb05c84fe03fee31ef61a21c4.zip
cpython-07e147667cf02cbcb05c84fe03fee31ef61a21c4.tar.gz
cpython-07e147667cf02cbcb05c84fe03fee31ef61a21c4.tar.bz2
Make int("...") return a long if an int would overflow.
Also remove the 512 character limitation for int(u"...") and long(u"..."). This closes SF bug #629989.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_b1.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/test/test_b1.py b/Lib/test/test_b1.py
index 65285ee..9e6c8d5 100644
--- a/Lib/test/test_b1.py
+++ b/Lib/test/test_b1.py
@@ -435,10 +435,8 @@ if int(s)+1 != -sys.maxint:
raise TestFailed, "int(%s)" % `s`
try:
int(s[1:])
-except ValueError:
- pass
-else:
- raise TestFailed, "int(%s)" % `s[1:]` + " should raise ValueError"
+except:
+ raise TestFailed, "int(%s)" % `s[1:]` + " should return long"
try:
int(1e100)
except OverflowError:
@@ -468,9 +466,12 @@ try: int('53', 40)
except ValueError: pass
else: raise TestFailed("int('53', 40) didn't raise ValueError")
-try: int('1' * 512)
-except ValueError: pass
-else: raise TestFailed("int('1' * 512) didn't raise ValueError")
+try: int('1' * 600)
+except: raise TestFailed("int('1' * 600) didn't return long")
+
+if have_unicode:
+ try: int(unichr(0x661) * 600)
+ except: raise TestFailed("int('\\u0661' * 600) didn't return long")
try: int(1, 12)
except TypeError: pass