Files
codeql/python/ql/src/Functions/examples/IncorrectRaiseInSpecialMethod2.py
Joe Farebrother 871688f026 Update docs
2025-07-24 16:01:57 +01:00

8 lines
212 B
Python

class C:
def __getitem__(self, idx):
if self.idx < 0:
# BAD: Should raise a KeyError or IndexError instead.
raise ValueError("Invalid index")
return self.lookup(idx)