SimpleDecoder.__getitem__ incorrectly validates exclusive [stop] of Python slice

Library version: PyNvVideoCodec 2.1.0 (pip, pynvvideocodec==2.1.0)

Bug:
SimpleDecoder.__getitem__ calls self.validate_index(key.stop) on the exclusive stop of a Python slice. This raises IndexError when stop == len(decoder), which is the normal Python convention for “all remaining elements.”

Location: SimpleDecoder.py, lines 88–94

elif isinstance(key, slice):
    indices = range(key.start, key.stop, key.step)  # stop is exclusive here ✓
    idxs = list(iter(indices))
    if not idxs:
        raise ValueError(f"Invalid input.")
    self.validate_index(key.start)
    self.validate_index(key.stop)      # ← BUG: validates exclusive stop as if inclusive
    return self.simple_decoder[idxs]

Reproduce:

import PyNvVideoCodec as nvc

dec = nvc.SimpleDecoder("any_video.mp4", output_color_type=nvc.OutputColorType.RGB)
n = len(dec)       # e.g. 107
frames = dec[0:n:1]  # IndexError: Index 107 is out of range [0, 106]

Expected: dec[0:n:1] should return all n frames, consistent with standard Python slice semantics where stop is exclusive.

Fix:
self.validate_index(key.stop - 1). Also, I’d probably move the self.validate(key.start) and self.validate(key.stop) before the whole range to list to reduce unnecessary computation before you know the range is safe.

I posted in deepstream_libraries in Github too bc I didn’t know where to file an official bug report

Hi @nikil.ragav1 ,
Thank you for reporting the bug. We are working on it.

Hi @nikil.ragav1 ,
We have addressed this in the latest release (v2.2.2).
Kindly use the latest wheels from Pypi.