Skip to content

Commit

Permalink
Fixed hashing of Pip types (Issue #46).
Browse files Browse the repository at this point in the history
  • Loading branch information
dloscutoff committed Nov 18, 2021
1 parent c80ad03 commit 9b5a110
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions ptypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ def __bool__(self):

def __eq__(self, rhs):
return type(self) is type(rhs) and self._value == rhs._value


__hash__ = PipIterable.__hash__

def __len__(self):
return len(self._value)

Expand Down Expand Up @@ -221,7 +223,9 @@ def __bool__(self):

def __eq__(self, rhs):
return type(rhs) == type(self) and self._raw == rhs._raw


__hash__ = PipType.__hash__

def __len__(self):
return len(self._raw)

Expand Down Expand Up @@ -311,6 +315,8 @@ def __bool__(self):
def __eq__(self, rhs):
return type(rhs) == type(self) and self._value == rhs._value

__hash__ = PipIterable.__hash__

def __len__(self):
return len(self._value)

Expand Down Expand Up @@ -448,6 +454,8 @@ def __eq__(self, rhs):
and self._lower == rhs._lower
and self._upper == rhs._upper)

__hash__ = PipIterable.__hash__

def __len__(self):
lower = self._lower or 0
if self._upper is not None:
Expand Down Expand Up @@ -624,6 +632,8 @@ def __eq__(self, rhs):
and self._statements == rhs._statements
and self._returnExpr == rhs._returnExpr)

__hash__ = PipType.__hash__

def toNumber(self):
return 0

Expand Down Expand Up @@ -659,6 +669,8 @@ def __iter__(self):
def __eq__(self, rhs):
return self is rhs

__hash__ = PipType.__hash__

def toNumber(self):
return 0

Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

VERSION = "1.0.1"
COMMIT_DATE = "2021-11-16"
COMMIT_DATE = "2021-11-18"

0 comments on commit 9b5a110

Please sign in to comment.