Message105670
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"); |
|
Date |
User |
Action |
Args |
2010-05-13 23:56:54 | vstinner | set | recipients:
+ vstinner, theller, stutzbach |
2010-05-13 23:56:54 | vstinner | set | messageid: <1273795014.34.0.614697096414.issue8670@psf.upfronthosting.co.za> |
2010-05-13 23:56:52 | vstinner | link | issue8670 messages |
2010-05-13 23:56:51 | vstinner | create | |
|