mirror of
https://github.com/python/cpython.git
synced 2025-07-15 07:15:18 +00:00
Issue 8781: On systems a signed 4-byte wchar_t and a 4-byte Py_UNICODE, use memcpy to convert between the two (as already done when wchar_t is unsigned)
This commit is contained in:
parent
16925e8539
commit
8515eaefda
4 changed files with 10 additions and 11 deletions
|
@ -664,7 +664,7 @@ PyObject *PyUnicode_FromWideChar(register const wchar_t *w,
|
|||
return NULL;
|
||||
|
||||
/* Copy the wchar_t data into the new object */
|
||||
#ifdef HAVE_USABLE_WCHAR_T
|
||||
#if Py_UNICODE_SIZE == SIZEOF_WCHAR_T
|
||||
memcpy(unicode->str, w, size * sizeof(wchar_t));
|
||||
#else
|
||||
{
|
||||
|
@ -1167,7 +1167,7 @@ Py_ssize_t PyUnicode_AsWideChar(PyUnicodeObject *unicode,
|
|||
if (size > PyUnicode_GET_SIZE(unicode))
|
||||
size = PyUnicode_GET_SIZE(unicode) + 1;
|
||||
|
||||
#ifdef HAVE_USABLE_WCHAR_T
|
||||
#if Py_UNICODE_SIZE == SIZEOF_WCHAR_T
|
||||
memcpy(w, unicode->str, size * sizeof(wchar_t));
|
||||
#else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue