Commit 41a234a6 authored by Victor Stinner's avatar Victor Stinner

Issue #16416: Fix compilation error

parent 27b1ca29
...@@ -169,7 +169,9 @@ _Py_wchar2char(const wchar_t *text, size_t *error_pos) ...@@ -169,7 +169,9 @@ _Py_wchar2char(const wchar_t *text, size_t *error_pos)
if (unicode == NULL) if (unicode == NULL)
return NULL; return NULL;
bytes = _PyUnicode_AsUTF8String(unicode, "surrogateescape"); bytes = PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
PyUnicode_GET_SIZE(unicode),
"surrogateescape");
Py_DECREF(unicode); Py_DECREF(unicode);
if (bytes == NULL) { if (bytes == NULL) {
PyErr_Clear(); PyErr_Clear();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment