mirror of
				https://github.com/nigels-com/glew.git
				synced 2025-10-31 04:32:20 +00:00 
			
		
		
		
	Use context manager instead of raw open
Raw open should be avoided to prevent that in case of an exception the file is not closed. This also has the advantage that if the user forgets to call close the file is still closed.
This commit is contained in:
		
							parent
							
								
									3cdab58d4e
								
							
						
					
					
						commit
						4e5fe20519
					
				| @ -148,13 +148,11 @@ if __name__ == '__main__': | ||||
| 
 | ||||
|     if len(options['core']): | ||||
|         for i in api[2].keys(): | ||||
|             f = open('%s/%s'%(options['core'], i), 'wb') | ||||
|             with open('%s/%s'%(options['core'], i), 'wb') as f: | ||||
|                 writeExtension(f, i, api[2][i], api[0], api[1]) | ||||
|             f.close() | ||||
| 
 | ||||
|     if len(options['extensions']): | ||||
|         for i in api[3].keys(): | ||||
|             f = open('%s/%s'%(options['extensions'], i), 'wb') | ||||
|             with open('%s/%s'%(options['extensions'], i), 'wb') as f: | ||||
|                 writeExtension(f, i, api[3][i], api[0], api[1]) | ||||
|             f.close() | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user