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 stutzbach, theller, vstinner
Date 2010-05-13.23:56:49
SpamBayes Score 0.000999883
Marked as misclassified No
Message-id <1273795014.34.0.614697096414.issue8670@psf.upfronthosting.co.za>
In-reply-to
Content
Patch for Python3:
 - Fix PyUnicode_AsWideChar() to support surrogates (Py_UNICODE: 2 bytes, wchar_t: 4 bytes)
 - u_set() of _ctypes uses PyUnicode_AsWideChar()
 - add a test (skipped if sizeof(wchar_t) is smaller than 4 bytes)

It's too late to fix Python2: 2.7 beta 2 was released (it doesn't support non BMP characters for chr()/ord()).

TODO:
 - I'm not sure that my patch on PyUnicode_AsWideChar() works if sizeof(wchar_t)==2
 - Test the patch on Windows
 - Check that it doesn't break other functions calling PyUnicode_AsWideChar()

ctypes, _locale.strcoll() and time.strftime() use PyUnicode_AsWideChar(). time has interesting comments:

    /* This assumes that PyUnicode_AsWideChar doesn't do any UTF-16
       expansion. */
    if (PyUnicode_AsWideChar((PyUnicodeObject*)format,
                             (wchar_t*)PyBytes_AS_STRING(tmpfmt),
                             PyUnicode_GetSize(format)+1) == (size_t)-1)
        /* This shouldn't fail. */
        Py_FatalError("PyUnicode_AsWideChar failed");
History
Date User Action Args
2010-05-13 23:56:54vstinnersetrecipients: + vstinner, theller, stutzbach
2010-05-13 23:56:54vstinnersetmessageid: <1273795014.34.0.614697096414.issue8670@psf.upfronthosting.co.za>
2010-05-13 23:56:52vstinnerlinkissue8670 messages
2010-05-13 23:56:51vstinnercreate