From efc7745831fdcc689c056cd43c595531fe9fea85 Mon Sep 17 00:00:00 2001 From: Marcel Bargull Date: Thu, 30 Aug 2018 20:31:44 +0200 Subject: [PATCH] PackageRecord: cache __hash__ value --- conda/models/records.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/conda/models/records.py b/conda/models/records.py index f1ee33ca04c..e339819c322 100644 --- a/conda/models/records.py +++ b/conda/models/records.py @@ -252,7 +252,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