mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	Added __del__ method to GzipFile class that will flush and close the
object, if required.
This commit is contained in:
		
							parent
							
								
									68921dfa31
								
							
						
					
					
						commit
						916fcc3b18
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
					@ -251,6 +251,11 @@ def close(self):
 | 
				
			||||||
            self.myfileobj.close()
 | 
					            self.myfileobj.close()
 | 
				
			||||||
            self.myfileobj = None
 | 
					            self.myfileobj = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def __del__(self):
 | 
				
			||||||
 | 
					        if (self.myfileobj is not None or
 | 
				
			||||||
 | 
					            self.fileobj is not None):
 | 
				
			||||||
 | 
					            self.close()
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
    def flush(self):
 | 
					    def flush(self):
 | 
				
			||||||
        self.fileobj.flush()
 | 
					        self.fileobj.flush()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue