Message80012
| Author |
vstinner |
| Recipients |
lemburg, mark.dickinson, rpetrov, vstinner |
| Date |
2009年01月17日.13:00:01 |
| SpamBayes Score |
3.7935337e-07 |
| Marked as misclassified |
No |
| Message-id |
<200901171359.55129.victor.stinner@haypocalc.com> |
| In-reply-to |
<1232185307.82.0.703488893991.issue4474@psf.upfronthosting.co.za> |
| Content |
> Looks pretty good at first glance, except that it seems that the UTF-32 to
> UTF-16 translation is skipped if HAVE_USABLE_WCHAR_T is defined. Is that
> deliberate?
#ifdef HAVE_USABLE_WCHAR_T
memcpy(unicode->str, w, size * sizeof(wchar_t));
#else
...
#endif
I understand this code as: sizeof(wchar_t) == sizeof(Py_UNICODE). If I
misunderstood the code, it's a a heap overflow :-) So there is no not
conversion from UTF-32 to UTF-16 using memcpy if HAVE_USABLE_WCHAR_T is
defined, right?
> A test would be good, too.
PyUnicode_FromWideChar() is not a public API. Should I write a function in
_testcapi? |
|