mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Fix Unicode encode_wstr_utf8() (#127420) Raise RuntimeError instead of RuntimeWarning. Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
828db9016b
commit
9f0d6b71d6
1 changed files with 1 additions and 1 deletions
|
@ -15446,7 +15446,7 @@ encode_wstr_utf8(wchar_t *wstr, char **str, const char *name)
|
||||||
int res;
|
int res;
|
||||||
res = _Py_EncodeUTF8Ex(wstr, str, NULL, NULL, 1, _Py_ERROR_STRICT);
|
res = _Py_EncodeUTF8Ex(wstr, str, NULL, NULL, 1, _Py_ERROR_STRICT);
|
||||||
if (res == -2) {
|
if (res == -2) {
|
||||||
PyErr_Format(PyExc_RuntimeWarning, "cannot decode %s", name);
|
PyErr_Format(PyExc_RuntimeError, "cannot encode %s", name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue