]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#ifdef out generation of \U escapes unless Py_UNICODE_WIDE. This
authorGuido van Rossum <guido@python.org>
Fri, 20 Jul 2001 16:36:21 +0000 (16:36 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 20 Jul 2001 16:36:21 +0000 (16:36 +0000)
#caused warnings with the VMS C compiler.  (SF bug #442998, in part.)
On a narrow system the current code should never be executed since ch
will always be < 0x10000.

Marc-Andre: you may end up fixing this a different way, since I
believe you have plans to generate \U for surrogate pairs.  I'll leave
that to you.

Objects/unicodeobject.c

index 08e80894d841a6e4d13b1d25979423d5fe58c1a8..a46df163f6f951cad2a249218812ae64a19343a8 100644 (file)
@@ -1441,6 +1441,7 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
             *p++ = '\\';
             *p++ = (char) ch;
         } 
+#ifdef Py_UNICODE_WIDE
         /* Map 21-bit characters to '\U00xxxxxx' */
         else if (ch >= 0x10000) {
             *p++ = '\\';
@@ -1454,6 +1455,7 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
             *p++ = hexdigit[(ch >> 4) & 0xf];
             *p++ = hexdigit[ch & 15];
         }
+#endif
         /* Map 16-bit characters to '\uxxxx' */
         else if (ch >= 256) {
             *p++ = '\\';