]> granicus.if.org Git - python/commitdiff
Marc-Andre Lemburg:
authorGuido van Rossum <guido@python.org>
Mon, 1 May 2000 21:27:20 +0000 (21:27 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 1 May 2000 21:27:20 +0000 (21:27 +0000)
Fixed \OOO interpretation for Unicode objects. \777 now
correctly produces the Unicode character with ordinal 511.

Objects/unicodeobject.c

index 9ed2336bec72ccd64a5f55d8a426f7f9397a9a1d..7a68dd40104d51b31583b5f30004ec3d9afa33ba 100644 (file)
@@ -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 */