mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	Jeremy Hylton:
better error message for unicode coercion failure
This commit is contained in:
		
							parent
							
								
									771d0675b6
								
							
						
					
					
						commit
						566d8a64eb
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		|  | @ -406,8 +406,10 @@ PyObject *PyUnicode_FromEncodedObject(register PyObject *obj, | |||
| 	/* Overwrite the error message with something more useful in
 | ||||
| 	   case of a TypeError. */ | ||||
| 	if (PyErr_ExceptionMatches(PyExc_TypeError)) | ||||
| 	    PyErr_SetString(PyExc_TypeError, | ||||
| 		  "coercing to Unicode: need string or buffer"); | ||||
| 	    PyErr_Format(PyExc_TypeError, | ||||
| 			 "coercing to Unicode: need string or buffer, " | ||||
| 			 "%.80s found", | ||||
| 			 obj->ob_type->tp_name); | ||||
| 	goto onError; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Marc-André Lemburg
						Marc-André Lemburg