summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2003-06-17 19:27:39 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2003-06-17 19:27:39 (GMT)
commite8049befdfa75501762f7b8afdf06335a2f6acba (patch)
tree4fe9873b63f2f55e6e5a18ea11341509fd8bc533 /Lib
parent8e9b80fd561e68574ee313f32d3fd6cde59d7723 (diff)
downloadcpython-e8049befdfa75501762f7b8afdf06335a2f6acba.zip
cpython-e8049befdfa75501762f7b8afdf06335a2f6acba.tar.gz
cpython-e8049befdfa75501762f7b8afdf06335a2f6acba.tar.bz2
Use _PyEval_SliceIndex to handle list.index() calls with
huge start and stop arguments. Add tests.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_types.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index 61f660b..f39c51a 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -374,6 +374,15 @@ if a.index(0,3) != 3: raise TestFailed, 'list index, start argument'
if a.index(0,-3) != 3: raise TestFailed, 'list index, -start argument'
if a.index(0,3,4) != 3: raise TestFailed, 'list index, stop argument'
if a.index(0,-3,-2) != 3: raise TestFailed, 'list index, -stop argument'
+if a.index(0,-4*sys.maxint,4*sys.maxint) != 2:
+ raise TestFailed, 'list index, -maxint, maxint argument'
+try:
+ a.index(0, 4*sys.maxint,-4*sys.maxint)
+except ValueError:
+ pass
+else:
+ raise TestFailed, 'list index, maxint,-maxint argument'
+
try:
a.index(2,0,-10)
except ValueError: