mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Revert r61969 which added casts to Py_CHARMASK to avoid compiler warnings.
Rather than sprinkle casts throughout the code, change Py_CHARMASK to always cast it's result to an unsigned char. This should ensure we do the right thing when accessing an array with the result.
This commit is contained in:
		
							parent
							
								
									36550bdde9
								
							
						
					
					
						commit
						d183bdd6fb
					
				
					 6 changed files with 23 additions and 31 deletions
				
			
		|  | @ -480,13 +480,13 @@ PyObject *PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size) | |||
| 	/* Single characters are shared when using this constructor.
 | ||||
|            Restrict to ASCII, since the input must be UTF-8. */ | ||||
| 	if (size == 1 && Py_CHARMASK(*u) < 128) { | ||||
| 	    unicode = unicode_latin1[(unsigned)Py_CHARMASK(*u)]; | ||||
| 	    unicode = unicode_latin1[Py_CHARMASK(*u)]; | ||||
| 	    if (!unicode) { | ||||
| 		unicode = _PyUnicode_New(1); | ||||
| 		if (!unicode) | ||||
| 		    return NULL; | ||||
| 		unicode->str[0] = Py_CHARMASK(*u); | ||||
| 		unicode_latin1[(unsigned)Py_CHARMASK(*u)] = unicode; | ||||
| 		unicode_latin1[Py_CHARMASK(*u)] = unicode; | ||||
| 	    } | ||||
| 	    Py_INCREF(unicode); | ||||
| 	    return (PyObject *)unicode; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Neal Norwitz
						Neal Norwitz