You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raiseValueError('Slice operation expects a bytes or a sequence of byte values')
483
+
slice_error=ValueError('Slice operation expects either a bytes, a sequence of byte values (0 <= byte <= 255), or anything convertible to bytes') # avoid duplication code
484
+
ifnotisinstance(byte, (bytes, bytearray)):
485
+
ifisinstance(byte, (list, tuple)):
486
+
try:
487
+
check=all(0<=x<255forxinbyte)
488
+
exceptTypeErrorasexc:
489
+
raiseslice_errorfromexc
490
+
ifnotcheck :
491
+
raiseslice_error
492
+
ifnotall(isinstance(x, int) forxinbyte) :
493
+
raiseslice_error
494
+
else :
495
+
try:
496
+
byte=bytes(byte) # check for int + 0<=x<=255 + convert to something getitem works with
0 commit comments