From: Victor Stinner Date: Mon, 2 Dec 2024 10:14:47 +0000 (+0100) Subject: Fix Unicode encode_wstr_utf8() (#127420) X-Git-Tag: v3.14.0a3~154 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bf21e2160d1dc6869fb230b90a23ab030835395b;p=thirdparty%2FPython%2Fcpython.git Fix Unicode encode_wstr_utf8() (#127420) Raise RuntimeError instead of RuntimeWarning. --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 33fa21d4c7d1..463da0644598 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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) {