Skip to content

Commit

Permalink
fix: remove error when using Python >= 3.11 (#7)
Browse files Browse the repository at this point in the history
Make Range immutable by adding __hash__ function. Needed to avoid errors using Python >= 3.11 triggered by the following change: https://docs.python.org/3.11/whatsnew/3.11.html#dataclasses
  • Loading branch information
ReinAchten-TomTom authored Oct 3, 2023
1 parent 4735f29 commit 98e0d27
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions llvm_diagnostics/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def end(self):
"""Returns the last index of the Range"""
return self.start + self.range

def __hash__(self):
return hash((self.start, self.range))


@dataclass
class __Message(Exception): # pylint: disable=C0103
Expand Down

0 comments on commit 98e0d27

Please sign in to comment.