This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients serhiy.storchaka, vstinner
Date 2018-06-21.10:57:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1529578633.76.0.56676864532.issue33928@psf.upfronthosting.co.za>
In-reply-to
Content
Extract of _Py_DecodeUTF8Ex() code, there is an explicit "write a surrogate pair" comment:

#if SIZEOF_WCHAR_T == 4
        ch = ucs4lib_utf8_decode(&s, e, (Py_UCS4 *)unicode, &outpos);
#else
        ch = ucs2lib_utf8_decode(&s, e, (Py_UCS2 *)unicode, &outpos);
#endif
        if (ch > 0xFF) {
#if SIZEOF_WCHAR_T == 4
            Py_UNREACHABLE();
#else
            assert(ch > 0xFFFF && ch <= MAX_UNICODE);
            /* write a surrogate pair */
            unicode[outpos++] = (wchar_t)Py_UNICODE_HIGH_SURROGATE(ch);
            unicode[outpos++] = (wchar_t)Py_UNICODE_LOW_SURROGATE(ch);
#endif
        }
History
Date User Action Args
2018-06-21 10:57:13vstinnersetrecipients: + vstinner, serhiy.storchaka
2018-06-21 10:57:13vstinnersetmessageid: <1529578633.76.0.56676864532.issue33928@psf.upfronthosting.co.za>
2018-06-21 10:57:13vstinnerlinkissue33928 messages
2018-06-21 10:57:13vstinnercreate