mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	#12266: Fix str.capitalize() to correctly uppercase/lowercase titlecased and cased non-letter characters.
This commit is contained in:
		
							parent
							
								
									388c945e97
								
							
						
					
					
						commit
						ee8d998ecf
					
				
					 3 changed files with 31 additions and 2 deletions
				
			
		|  | @ -6658,13 +6658,13 @@ int fixcapitalize(PyUnicodeObject *self) | |||
| 
 | ||||
|     if (len == 0) | ||||
|         return 0; | ||||
|     if (Py_UNICODE_ISLOWER(*s)) { | ||||
|     if (!Py_UNICODE_ISUPPER(*s)) { | ||||
|         *s = Py_UNICODE_TOUPPER(*s); | ||||
|         status = 1; | ||||
|     } | ||||
|     s++; | ||||
|     while (--len > 0) { | ||||
|         if (Py_UNICODE_ISUPPER(*s)) { | ||||
|         if (!Py_UNICODE_ISLOWER(*s)) { | ||||
|             *s = Py_UNICODE_TOLOWER(*s); | ||||
|             status = 1; | ||||
|         } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ezio Melotti
						Ezio Melotti