str slice: Trim slice indexes to be in range.

This commit is contained in:
Paul Sokolovsky
2014-01-04 03:47:34 +02:00
parent c8d1384fc0
commit 6ee1e383d6
2 changed files with 16 additions and 0 deletions

View File

@@ -22,6 +22,11 @@ print(b"123"[0:])
print(b"123"[:0])
print(b"123"[:-3])
print(b"123"[:-4])
# Range check testing, don't segfault, please ;-)
print(b"123"[:1000000])
print(b"123"[1000000:])
print(b"123"[:-1000000])
print(b"123"[-1000000:])
# No IndexError!
print(b""[1:1])
print(b""[-1:-1])