Removed PyInt_GetMax and sys.maxint

I replaced sys.maxint with sys.maxsize in Lib/*.py. Does anybody see a problem with the change on Win 64bit platforms? Win 64's long is just 32bit but the sys.maxsize is now 2**63-1 on every 64bit platform.
Also added docs for sys.maxsize.
This commit is contained in:
Christian Heimes 2007-12-04 23:02:19 +00:00
parent 327858ef2c
commit a37d4c693a
47 changed files with 142 additions and 150 deletions

View file

@ -36,14 +36,14 @@ class BytesTest(unittest.TestCase):
self.assertEqual(len(b), 0)
self.assertRaises(IndexError, lambda: b[0])
self.assertRaises(IndexError, lambda: b[1])
self.assertRaises(IndexError, lambda: b[sys.maxint])
self.assertRaises(IndexError, lambda: b[sys.maxint+1])
self.assertRaises(IndexError, lambda: b[sys.maxsize])
self.assertRaises(IndexError, lambda: b[sys.maxsize+1])
self.assertRaises(IndexError, lambda: b[10**100])
self.assertRaises(IndexError, lambda: b[-1])
self.assertRaises(IndexError, lambda: b[-2])
self.assertRaises(IndexError, lambda: b[-sys.maxint])
self.assertRaises(IndexError, lambda: b[-sys.maxint-1])
self.assertRaises(IndexError, lambda: b[-sys.maxint-2])
self.assertRaises(IndexError, lambda: b[-sys.maxsize])
self.assertRaises(IndexError, lambda: b[-sys.maxsize-1])
self.assertRaises(IndexError, lambda: b[-sys.maxsize-2])
self.assertRaises(IndexError, lambda: b[-10**100])
def test_from_list(self):
@ -83,14 +83,14 @@ class BytesTest(unittest.TestCase):
def test_constructor_value_errors(self):
self.assertRaises(ValueError, bytearray, [-1])
self.assertRaises(ValueError, bytearray, [-sys.maxint])
self.assertRaises(ValueError, bytearray, [-sys.maxint-1])
self.assertRaises(ValueError, bytearray, [-sys.maxint-2])
self.assertRaises(ValueError, bytearray, [-sys.maxsize])
self.assertRaises(ValueError, bytearray, [-sys.maxsize-1])
self.assertRaises(ValueError, bytearray, [-sys.maxsize-2])
self.assertRaises(ValueError, bytearray, [-10**100])
self.assertRaises(ValueError, bytearray, [256])
self.assertRaises(ValueError, bytearray, [257])
self.assertRaises(ValueError, bytearray, [sys.maxint])
self.assertRaises(ValueError, bytearray, [sys.maxint+1])
self.assertRaises(ValueError, bytearray, [sys.maxsize])
self.assertRaises(ValueError, bytearray, [sys.maxsize+1])
self.assertRaises(ValueError, bytearray, [10**100])
def test_repr_str(self):
@ -412,7 +412,7 @@ class BytesTest(unittest.TestCase):
self.assertRaises(TypeError, lambda: 3.14 * b)
# XXX Shouldn't bytes and bytearray agree on what to raise?
self.assertRaises((OverflowError, MemoryError),
lambda: b * sys.maxint)
lambda: b * sys.maxsize)
def test_repeat_1char(self):
self.assertEqual(b'x'*100, bytearray([ord('x')]*100))