mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Marc-Andre Lemburg:
Fixed \OOO interpretation for Unicode objects. \777 now correctly produces the Unicode character with ordinal 511.
This commit is contained in:
		
							parent
							
								
									96774c1347
								
							
						
					
					
						commit
						0e4f657a50
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		|  | @ -1016,13 +1016,13 @@ PyObject *PyUnicode_DecodeUnicodeEscape(const char *s, | |||
|         /* \OOO (octal) escapes */ | ||||
|         case '0': case '1': case '2': case '3': | ||||
|         case '4': case '5': case '6': case '7': | ||||
|             c = s[-1] - '0'; | ||||
|             x = s[-1] - '0'; | ||||
|             if ('0' <= *s && *s <= '7') { | ||||
|                 c = (c<<3) + *s++ - '0'; | ||||
|                 x = (x<<3) + *s++ - '0'; | ||||
|                 if ('0' <= *s && *s <= '7') | ||||
|                     c = (c<<3) + *s++ - '0'; | ||||
|                     x = (x<<3) + *s++ - '0'; | ||||
|             } | ||||
|             *p++ = c; | ||||
|             *p++ = x; | ||||
|             break; | ||||
| 
 | ||||
|         /* \xXXXX escape with 0-4 hex digits */ | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Guido van Rossum
						Guido van Rossum