mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Fix two issues in the weak set implementation.
This commit is contained in:
		
							parent
							
								
									e624d17409
								
							
						
					
					
						commit
						bf93b0470a
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
					@ -41,7 +41,10 @@ def copy(self):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def pop(self):
 | 
					    def pop(self):
 | 
				
			||||||
        while True:
 | 
					        while True:
 | 
				
			||||||
 | 
					            try:
 | 
				
			||||||
                itemref = self.data.pop()
 | 
					                itemref = self.data.pop()
 | 
				
			||||||
 | 
					            except KeyError:
 | 
				
			||||||
 | 
					                raise KeyError('pop from empty WeakSet')
 | 
				
			||||||
            item = itemref()
 | 
					            item = itemref()
 | 
				
			||||||
            if item is not None:
 | 
					            if item is not None:
 | 
				
			||||||
                return item
 | 
					                return item
 | 
				
			||||||
| 
						 | 
					@ -107,5 +110,5 @@ def symmetric_difference_update(self, other):
 | 
				
			||||||
    __ixor__ = symmetric_difference_update
 | 
					    __ixor__ = symmetric_difference_update
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def union(self, other):
 | 
					    def union(self, other):
 | 
				
			||||||
        self._apply_mutate(other, self.data.union)
 | 
					        return self._apply(other, self.data.union)
 | 
				
			||||||
    __or__ = union
 | 
					    __or__ = union
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue