8000 [3.12] Fix Unicode encode_wstr_utf8() (#127420) (#127504) · python/cpython@9f0d6b7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9f0d6b7

Browse files
picnixzvstinner
andauthored
[3.12] Fix Unicode encode_wstr_utf8() (#127420) (#127504)
Fix Unicode encode_wstr_utf8() (#127420) Raise RuntimeError instead of RuntimeWarning. Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 828db90 commit 9f0d6b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Objects/unicodeobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15446,7 +15446,7 @@ encode_wstr_utf8(wchar_t *wstr, char **str, const char *name)
1544615446
int res;
1544715447
res = _Py_EncodeUTF8Ex(wstr, str, NULL, NULL, 1, _Py_ERROR_STRICT);
1544815448
if (res == -2) {
15449-
PyErr_Format(PyExc_RuntimeWarning, "cannot decode %s", name);
15449+
PyErr_Format(PyExc_RuntimeError, "cannot encode %s", name);
1545015450
return -1;
1545115451
}
1545215452
if (res < 0) {

0 commit comments

Comments
 (0)
0