Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0e4f657

Browse files
committed
Marc-Andre Lemburg:
Fixed \OOO interpretation for Unicode objects. \777 now correctly produces the Unicode character with ordinal 511.
1 parent 96774c1 commit 0e4f657

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Objects/unicodeobject.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,13 +1016,13 @@ PyObject *PyUnicode_DecodeUnicodeEscape(const char *s,
10161016
/* \OOO (octal) escapes */
10171017
case '0': case '1': case '2': case '3':
10181018
case '4': case '5': case '6': case '7':
1019-
c = s[-1] - '0';
1019+
x = s[-1] - '0';
10201020
if ('0' <= *s && *s <= '7') {
1021-
c = (c<<3) + *s++ - '0';
1021+
x = (x<<3) + *s++ - '0';
10221022
if ('0' <= *s && *s <= '7')
1023-
c = (c<<3) + *s++ - '0';
1023+
x = (x<<3) + *s++ - '0';
10241024
}
1025-
*p++ = c;
1025+
*p++ = x;
10261026
break;
10271027

10281028
/* \xXXXX escape with 0-4 hex digits */

0 commit comments

Comments
 (0)