mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Make struct tests pass.
This commit is contained in:
		
							parent
							
								
									54ad523f02
								
							
						
					
					
						commit
						e625fd5444
					
				
					 3 changed files with 41 additions and 24 deletions
				
			
		|  | @ -608,9 +608,14 @@ np_ubyte(char *p, PyObject *v, const formatdef *f) | |||
| static int | ||||
| np_char(char *p, PyObject *v, const formatdef *f) | ||||
| { | ||||
| 	if (PyUnicode_Check(v)) { | ||||
| 		v = _PyUnicode_AsDefaultEncodedString(v, NULL); | ||||
| 		if (v == NULL) | ||||
| 			return -1; | ||||
| 	} | ||||
| 	if (!PyString_Check(v) || PyString_Size(v) != 1) { | ||||
| 		PyErr_SetString(StructError, | ||||
| 				"char format require string of length 1"); | ||||
| 				"char format requires string of length 1"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	*p = *PyString_AsString(v); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Guido van Rossum
						Guido van Rossum