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
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 @@
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.