[Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.47,2.48

Fredrik Lundh python-dev@python.org
Sun, 16 Jul 2000 11:47:46 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory slayer.i.sourceforge.net:/tmp/cvs-serv19385/objects

Modified Files:
	unicodeobject.c 
Log Message:


- change \x to mean "byte" also in unicode literals
  (patch #100912)

Index: unicodeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v
retrieving revision 2.47
retrieving revision 2.48
diff -C2 -r2.47 -r2.48
*** unicodeobject.c	2000/07/16 17:10:50	2.47
--- unicodeobject.c	2000/07/16 18:47:43	2.48
***************
*** 1199,1203 ****
              break;
  
!         /* \xXXXX escape with 0-4 hex digits */
          case 'x':
              x = 0;
--- 1199,1205 ----
              break;
  
!         /* \xXXXX escape with 1-n hex digits.  for compatibility
!            with 8-bit strings, this code ignores all but the last
!            two digits */
          case 'x':
              x = 0;
***************
*** 1205,1209 ****
              if (isxdigit(c)) {
                  do {
!                     x = (x<<4) & ~0xF;
                      if ('0' <= c && c <= '9')
                          x += c - '0';
--- 1207,1211 ----
              if (isxdigit(c)) {
                  do {
!                     x = (x<<4) & 0xF0;
                      if ('0' <= c && c <= '9')
                          x += c - '0';
***************
*** 1214,1218 ****
                      c = (unsigned char)*++s;
                  } while (isxdigit(c));
!                 *p++ = x;
              } else {
                  *p++ = '\\';
--- 1216,1220 ----
                      c = (unsigned char)*++s;
                  } while (isxdigit(c));
!                 *p++ = (unsigned char) x;
              } else {
                  *p++ = '\\';