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

Skip to content

Commit 41a234a

Browse files
committed
Issue #16416: Fix compilation error
1 parent 27b1ca2 commit 41a234a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Python/fileutils.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ _Py_wchar2char(const wchar_t *text, size_t *error_pos)
169169
if (unicode == NULL)
170170
return NULL;
171171

172-
bytes = _PyUnicode_AsUTF8String(unicode, "surrogateescape");
172+
bytes = PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
173+
PyUnicode_GET_SIZE(unicode),
174+
"surrogateescape");
173175
Py_DECREF(unicode);
174176
if (bytes == NULL) {
175177
PyErr_Clear();

0 commit comments

Comments
 (0)