Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3cc3452

Browse files
committed
Change PyUnicode_EncodeUTF16() so that it returns
bytes objects instead of str8 objects.
1 parent bf58bd6 commit 3cc3452

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Objects/unicodeobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,12 +1726,12 @@ PyUnicode_EncodeUTF16(const Py_UNICODE *s,
17261726
if (s[i] >= 0x10000)
17271727
pairs++;
17281728
#endif
1729-
v = PyString_FromStringAndSize(NULL,
1729+
v = PyBytes_FromStringAndSize(NULL,
17301730
2 * (size + pairs + (byteorder == 0)));
17311731
if (v == NULL)
17321732
return NULL;
17331733

1734-
p = (unsigned char *)PyString_AS_STRING(v);
1734+
p = (unsigned char *)PyBytes_AS_STRING(v);
17351735
if (byteorder == 0)
17361736
STORECHAR(0xFEFF);
17371737
if (size == 0)

0 commit comments

Comments
 (0)