mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
#ifdef out generation of \U escapes unless Py_UNICODE_WIDE. This
#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.
This commit is contained in:
parent
9079164bdf
commit
0d42e0c54a
1 changed files with 2 additions and 0 deletions
|
@ -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++ = '\\';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue