Skip to content

Commit bf21e21

Browse files
authored
Fix Unicode encode_wstr_utf8() (python#127420)
Raise RuntimeError instead of RuntimeWarning.
1 parent a8dd821 commit bf21e21

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
@@ -16158,7 +16158,7 @@ encode_wstr_utf8(wchar_t *wstr, char **str, const char *name)
1615816158
int res;
1615916159
res = _Py_EncodeUTF8Ex(wstr, str, NULL, NULL, 1, _Py_ERROR_STRICT);
1616016160
if (res == -2) {
16161-
PyErr_Format(PyExc_RuntimeWarning, "cannot encode %s", name);
16161+
PyErr_Format(PyExc_RuntimeError, "cannot encode %s", name);
1616216162
return -1;
1616316163
}
1616416164
if (res < 0) {

0 commit comments

Comments
 (0)