Skip to content

Commit

Permalink
Fix Unicode encode_wstr_utf8() (python#127420)
Browse files Browse the repository at this point in the history
Raise RuntimeError instead of RuntimeWarning.
  • Loading branch information
vstinner authored Dec 2, 2024
1 parent a8dd821 commit bf21e21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -16158,7 +16158,7 @@ encode_wstr_utf8(wchar_t *wstr, char **str, const char *name)
int res;
res = _Py_EncodeUTF8Ex(wstr, str, NULL, NULL, 1, _Py_ERROR_STRICT);
if (res == -2) {
PyErr_Format(PyExc_RuntimeWarning, "cannot encode %s", name);
PyErr_Format(PyExc_RuntimeError, "cannot encode %s", name);
return -1;
}
if (res < 0) {
Expand Down

0 comments on commit bf21e21

Please sign in to comment.