Skip to content

Commit

Permalink
Merge pull request conda#7715 from mbargull/record-hash-cached
Browse files Browse the repository at this point in the history
PackageRecord: cache __hash__ value
  • Loading branch information
kalefranz authored Sep 4, 2018
2 parents 8b288a9 + efc7745 commit 77c5d2a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion conda/models/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,11 @@ def _pkey(self):
return __pkey

def __hash__(self):
return hash(self._pkey)
try:
return self._hash
except AttributeError:
self._hash = hash(self._pkey)
return self._hash

def __eq__(self, other):
return self._pkey == other._pkey
Expand Down

0 comments on commit 77c5d2a

Please sign in to comment.