diff options
author | Walter Dörwald <walter@livinglogic.de> | 2002-11-19 20:49:15 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2002-11-19 20:49:15 (GMT) |
commit | f171540ab8d816a996c34db3f6aa4bf9cf147fba (patch) | |
tree | 001d1ff0bdea449058218d2debf6d6f8dbbcb220 /Lib/test/test_b1.py | |
parent | 7a3bae410df3dd0032509b97077d0c4d98276fdd (diff) | |
download | cpython-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.py | 14 |
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. |