https://github.com/python/cpython/commit/f218549afc7845ccc4168ceecb1f94ff1c58468a
commit: f218549afc7845ccc4168ceecb1f94ff1c58468a
branch: 3.13
author: Serhiy Storchaka <storch...@gmail.com>
committer: serhiy-storchaka <storch...@gmail.com>
date: 2025-04-14T18:59:07Z
summary:

[3.13] gh-124476: Fix decoding from the locale encoding in the C.UTF-8 locale 
(GH-132477) (ПР-132528)

(cherry picked from commit 102f825c5112cbe6985edc0971822b07bd778135)

files:
A Misc/NEWS.d/next/Core and 
Builtins/2025-04-13-17-18-01.gh-issue-124476.fvGfQ7.rst
M Python/fileutils.c

diff --git a/Misc/NEWS.d/next/Core and 
Builtins/2025-04-13-17-18-01.gh-issue-124476.fvGfQ7.rst b/Misc/NEWS.d/next/Core 
and Builtins/2025-04-13-17-18-01.gh-issue-124476.fvGfQ7.rst
new file mode 100644
index 00000000000000..be0ecee95ded39
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and 
Builtins/2025-04-13-17-18-01.gh-issue-124476.fvGfQ7.rst 
@@ -0,0 +1 @@
+Fix decoding from the locale encoding in the C.UTF-8 locale.
diff --git a/Python/fileutils.c b/Python/fileutils.c
index 9529b14d377c60..921500bfef1d4e 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -523,15 +523,7 @@ decode_current_locale(const char* arg, wchar_t **wstr, 
size_t *wlen,
             break;
         }
 
-        if (converted == INCOMPLETE_CHARACTER) {
-            /* Incomplete character. This should never happen,
-               since we provide everything that we have -
-               unless there is a bug in the C library, or I
-               misunderstood how mbrtowc works. */
-            goto decode_error;
-        }
-
-        if (converted == DECODE_ERROR) {
+        if (converted == DECODE_ERROR || converted == INCOMPLETE_CHARACTER) {
             if (!surrogateescape) {
                 goto decode_error;
             }

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to