[Patches] Fix for ord(u'\777')

M.-A. Lemburg mal@lemburg.com
Mon, 01 May 2000 23:22:11 +0200


This is a multi-part message in MIME format.
--------------B79882C431C01EF7F5593B52
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Patch Set Contents:
-------------------

Objects/unicodeobject.c:

Fixed \OOO interpretation for Unicode objects. \777 now
correctly produces the Unicode character with ordinal 511.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/
--------------B79882C431C01EF7F5593B52
Content-Type: text/plain; charset=us-ascii;
 name="Unicode-Implementation-2000-05-01a.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="Unicode-Implementation-2000-05-01a.patch"

--- CVS-Python/Objects/unicodeobject.c	Mon May  1 12:39:41 2000
+++ Python+Unicode/Objects/unicodeobject.c	Mon May  1 23:13:47 2000
@@ -1014,17 +1014,17 @@ PyObject *PyUnicode_DecodeUnicodeEscape(
         case 'a': *p++ = '\007'; break; /* BEL, not classic C */
 
         /* \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 */
         case 'x':
             x = 0;

--------------B79882C431C01EF7F5593B52--