parent
c7984463c7
commit
3180a17fd9
2 changed files with 5 additions and 2 deletions
|
|
@ -796,11 +796,11 @@ class Slice(Value):
|
|||
raise TypeError("Slice stop must be an integer, not {!r}".format(stop))
|
||||
|
||||
n = len(value)
|
||||
if start not in range(-(n+1), n+1):
|
||||
if start not in range(-n, n+1):
|
||||
raise IndexError("Cannot start slice {} bits into {}-bit value".format(start, n))
|
||||
if start < 0:
|
||||
start += n
|
||||
if stop not in range(-(n+1), n+1):
|
||||
if stop not in range(-n, n+1):
|
||||
raise IndexError("Cannot stop slice {} bits into {}-bit value".format(stop, n))
|
||||
if stop < 0:
|
||||
stop += n
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue