]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-124476: Fix decoding from the locale encoding in the C.UTF-8 locale (GH-132477)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 14 Apr 2025 18:32:41 +0000 (21:32 +0300)
committerGitHub <noreply@github.com>
Mon, 14 Apr 2025 18:32:41 +0000 (21:32 +0300)
Misc/NEWS.d/next/Core_and_Builtins/2025-04-13-17-18-01.gh-issue-124476.fvGfQ7.rst [new file with mode: 0644]
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 (file)
index 0000000..be0ecee
--- /dev/null
@@ -0,0 +1 @@
+Fix decoding from the locale encoding in the C.UTF-8 locale.
index 95b64ed76fb974e428059137c4384c6de6652bc4..78603d40704f14de4d5ebe86eaa9612fa50f7d8a 100644 (file)
@@ -528,15 +528,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;
             }