summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_b1.py
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2002-11-19 20:49:15 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2002-11-19 20:49:15 (GMT)
commitf171540ab8d816a996c34db3f6aa4bf9cf147fba (patch)
tree001d1ff0bdea449058218d2debf6d6f8dbbcb220 /Lib/test/test_b1.py
parent7a3bae410df3dd0032509b97077d0c4d98276fdd (diff)
downloadcpython-f171540ab8d816a996c34db3f6aa4bf9cf147fba.zip
cpython-f171540ab8d816a996c34db3f6aa4bf9cf147fba.tar.gz
cpython-f171540ab8d816a996c34db3f6aa4bf9cf147fba.tar.bz2
Change int() so that passing a string, unicode, float or long argument
that is outside the integer range no longer raises OverflowError, but returns a long object instead. This fixes SF bug http://www.python.org/sf/635115
Diffstat (limited to 'Lib/test/test_b1.py')
-rw-r--r--Lib/test/test_b1.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/Lib/test/test_b1.py b/Lib/test/test_b1.py
index 249f1fa..3033667 100644
--- a/Lib/test/test_b1.py
+++ b/Lib/test/test_b1.py
@@ -438,17 +438,19 @@ try:
except:
raise TestFailed, "int(%s)" % `s[1:]` + " should return long"
try:
- int(1e100)
+ x = int(1e100)
except OverflowError:
- pass
+ raise TestFailed("int(1e100) mustn't raise OverflowError")
else:
- raise TestFailed("int(1e100) expected OverflowError")
+ if not isinstance(x, long):
+ raise TestFailed("int(1e100) should have returned long")
try:
- int(-1e100)
+ x = int(-1e100)
except OverflowError:
- pass
+ raise TestFailed("int(-1e100) mustn't raise OverflowError")
else:
- raise TestFailed("int(-1e100) expected OverflowError")
+ if not isinstance(x, long):
+ raise TestFailed("int(-1e100) should have returned long")
# SF bug 434186: 0x80000000/2 != 0x80000000>>1.