[Python-checkins] cpython: tracemalloc: Fix hash methods of Statistic and StatisticDiff

victor.stinner python-checkins at python.org
Tue Nov 26 10:16:45 CET 2013


http://hg.python.org/cpython/rev/9eae3a8181bc
changeset:   87576:9eae3a8181bc
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Nov 26 10:16:25 2013 +0100
summary:
  tracemalloc: Fix hash methods of Statistic and StatisticDiff

files:
  Lib/tracemalloc.py |  7 +++----
  1 files changed, 3 insertions(+), 4 deletions(-)


diff --git a/Lib/tracemalloc.py b/Lib/tracemalloc.py
--- a/Lib/tracemalloc.py
+++ b/Lib/tracemalloc.py
@@ -39,7 +39,7 @@
         self.count = count
 
     def __hash__(self):
-        return (self.traceback, self.size, self.count)
+        return hash((self.traceback, self.size, self.count))
 
     def __eq__(self, other):
         return (self.traceback == other.traceback
@@ -79,8 +79,8 @@
         self.count_diff = count_diff
 
     def __hash__(self):
-        return (self.traceback, self.size, self.size_diff,
-                self.count, self.count_diff)
+        return hash((self.traceback, self.size, self.size_diff,
+                     self.count, self.count_diff))
 
     def __eq__(self, other):
         return (self.traceback == other.traceback
@@ -104,7 +104,6 @@
     def __repr__(self):
         return ('<StatisticDiff traceback=%r size=%i (%+i) count=%i (%+i)>'
                 % (self.traceback, self.size, self.size_diff,
-
                    self.count, self.count_diff))
 
     def _sort_key(self):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list