Skip to content

Commit

Permalink
[3.12] Fix Unicode encode_wstr_utf8() (python#127420) (python#127504)
Browse files Browse the repository at this point in the history
Fix Unicode encode_wstr_utf8() (python#127420)

Raise RuntimeError instead of RuntimeWarning.

Co-authored-by: Victor Stinner <[email protected]>
  • Loading branch information
picnixz and vstinner authored Dec 2, 2024
1 parent 828db90 commit 9f0d6b7
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 @@ -15446,7 +15446,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 decode %s", name);
PyErr_Format(PyExc_RuntimeError, "cannot encode %s", name);
return -1;
}
if (res < 0) {
Expand Down

0 comments on commit 9f0d6b7

Please sign in to comment.