mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	Ignore IOError exceptions when writing the message.
This commit is contained in:
		
							parent
							
								
									ccd9e75b18
								
							
						
					
					
						commit
						51a0ae3f97
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		|  | @ -107,7 +107,10 @@ def showwarning(message, category, filename, lineno, file=None): | |||
|     """Hook to write a warning to a file; replace if you like.""" | ||||
|     if file is None: | ||||
|         file = sys.stderr | ||||
|     file.write(formatwarning(message, category, filename, lineno)) | ||||
|     try: | ||||
|         file.write(formatwarning(message, category, filename, lineno)) | ||||
|     except IOError: | ||||
|         pass # the file (probably stderr) is invalid - this warning gets lost. | ||||
| 
 | ||||
| def formatwarning(message, category, filename, lineno): | ||||
|     """Function to format a warning the standard way.""" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Mark Hammond
						Mark Hammond