diff options
author | Kristján Valur Jónsson <kristjan@ccpgames.com> | 2012-06-06 21:58:08 (GMT) |
---|---|---|
committer | Kristján Valur Jónsson <kristjan@ccpgames.com> | 2012-06-06 21:58:08 (GMT) |
commit | 55e5dc8371bb29e970b0f94384d042b0f4aaac16 (patch) | |
tree | f7a426d83f76f3a91bf6940d9691fe017ad5d702 /Objects | |
parent | a3394bce336372848921690dbac5e504d369f174 (diff) | |
download | cpython-55e5dc8371bb29e970b0f94384d042b0f4aaac16.zip cpython-55e5dc8371bb29e970b0f94384d042b0f4aaac16.tar.gz cpython-55e5dc8371bb29e970b0f94384d042b0f4aaac16.tar.bz2 |
Rearrange code to beat an optimizer bug affecting Release x64 on windows
with VS2010sp1
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index c37d8dd..a1efec0 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -12038,30 +12038,28 @@ unicode_repr(PyObject *unicode) (categories Z* and C* except ASCII space) */ if (!Py_UNICODE_ISPRINTABLE(ch)) { + PyUnicode_WRITE(okind, odata, o++, '\\'); /* Map 8-bit characters to '\xhh' */ if (ch <= 0xff) { - PyUnicode_WRITE(okind, odata, o++, '\\'); PyUnicode_WRITE(okind, odata, o++, 'x'); PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[(ch >> 4) & 0x000F]); PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[ch & 0x000F]); } - /* Map 21-bit characters to '\U00xxxxxx' */ - else if (ch >= 0x10000) { - PyUnicode_WRITE(okind, odata, o++, '\\'); - PyUnicode_WRITE(okind, odata, o++, 'U'); - PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[(ch >> 28) & 0xF]); - PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[(ch >> 24) & 0xF]); - PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[(ch >> 20) & 0xF]); - PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[(ch >> 16) & 0xF]); + /* Map 16-bit characters to '\uxxxx' */ + else if (ch <= 0xffff) { + PyUnicode_WRITE(okind, odata, o++, 'u'); PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[(ch >> 12) & 0xF]); PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[(ch >> 8) & 0xF]); PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[(ch >> 4) & 0xF]); PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[ch & 0xF]); } - /* Map 16-bit characters to '\uxxxx' */ + /* Map 21-bit characters to '\U00xxxxxx' */ else { - PyUnicode_WRITE(okind, odata, o++, '\\'); - PyUnicode_WRITE(okind, odata, o++, 'u'); + PyUnicode_WRITE(okind, odata, o++, 'U'); + PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[(ch >> 28) & 0xF]); + PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[(ch >> 24) & 0xF]); + PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[(ch >> 20) & 0xF]); + PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[(ch >> 16) & 0xF]); PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[(ch >> 12) & 0xF]); PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[(ch >> 8) & 0xF]); PyUnicode_WRITE(okind, odata, o++, Py_hexdigits[(ch >> 4) & 0xF]); |