https://github.com/python/cpython/commit/9f0d6b71d677363f305c63cb5601c1410310435e
commit: 9f0d6b71d677363f305c63cb5601c1410310435e
branch: 3.12
author: Bénédikt Tran <[email protected]>
committer: vstinner <[email protected]>
date: 2024-12-02T13:24:26+01:00
summary:

[3.12] Fix Unicode encode_wstr_utf8() (#127420) (#127504)

Fix Unicode encode_wstr_utf8() (#127420)

Raise RuntimeError instead of RuntimeWarning.

Co-authored-by: Victor Stinner <[email protected]>

files:
M Objects/unicodeobject.c

diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 5f3dd26ad7b762..ba11351f003007 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -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) {

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to