mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 11:40:18 +01:00
Merge pull request #64 from pfalcon/str-slice-range-check
str slice: Trim slice indexes to be in range.
This commit is contained in:
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user