mirror of
				https://github.com/python/cpython.git
				synced 2025-10-27 03:34:32 +00:00 
			
		
		
		
	Use repr() on the filename in EnvironmentError.__str__(). This
displays funny characters, like spaces or control characters, more clearly (one of my pet peeves in error messages). Also only suppress the filename if it is None; display it if it is '', since that would be a genuine (illegal) filename passed in!
This commit is contained in:
		
							parent
							
								
									ee9306b610
								
							
						
					
					
						commit
						be21d98cee
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		|  | @ -104,9 +104,9 @@ def __init__(self, *args): | |||
|             self.errno, self.strerror = args | ||||
| 
 | ||||
|     def __str__(self): | ||||
|         if self.filename: | ||||
|         if self.filename is not None: | ||||
|             return '[Errno %s] %s: %s' % (self.errno, self.strerror, | ||||
|                                         self.filename) | ||||
|                                           repr(self.filename)) | ||||
|         elif self.errno and self.strerror: | ||||
|             return '[Errno %s] %s' % (self.errno, self.strerror) | ||||
|         else: | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Guido van Rossum
						Guido van Rossum