mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	tracemalloc: Fix hash methods of Statistic and StatisticDiff
This commit is contained in:
		
							parent
							
								
									5831882c08
								
							
						
					
					
						commit
						802a484e24
					
				
					 1 changed files with 3 additions and 4 deletions
				
			
		|  | @ -39,7 +39,7 @@ def __init__(self, traceback, size, count): | ||||||
|         self.count = count |         self.count = count | ||||||
| 
 | 
 | ||||||
|     def __hash__(self): |     def __hash__(self): | ||||||
|         return (self.traceback, self.size, self.count) |         return hash((self.traceback, self.size, self.count)) | ||||||
| 
 | 
 | ||||||
|     def __eq__(self, other): |     def __eq__(self, other): | ||||||
|         return (self.traceback == other.traceback |         return (self.traceback == other.traceback | ||||||
|  | @ -79,8 +79,8 @@ def __init__(self, traceback, size, size_diff, count, count_diff): | ||||||
|         self.count_diff = count_diff |         self.count_diff = count_diff | ||||||
| 
 | 
 | ||||||
|     def __hash__(self): |     def __hash__(self): | ||||||
|         return (self.traceback, self.size, self.size_diff, |         return hash((self.traceback, self.size, self.size_diff, | ||||||
|                 self.count, self.count_diff) |                      self.count, self.count_diff)) | ||||||
| 
 | 
 | ||||||
|     def __eq__(self, other): |     def __eq__(self, other): | ||||||
|         return (self.traceback == other.traceback |         return (self.traceback == other.traceback | ||||||
|  | @ -104,7 +104,6 @@ def __str__(self): | ||||||
|     def __repr__(self): |     def __repr__(self): | ||||||
|         return ('<StatisticDiff traceback=%r size=%i (%+i) count=%i (%+i)>' |         return ('<StatisticDiff traceback=%r size=%i (%+i) count=%i (%+i)>' | ||||||
|                 % (self.traceback, self.size, self.size_diff, |                 % (self.traceback, self.size, self.size_diff, | ||||||
| 
 |  | ||||||
|                    self.count, self.count_diff)) |                    self.count, self.count_diff)) | ||||||
| 
 | 
 | ||||||
|     def _sort_key(self): |     def _sort_key(self): | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner