aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/fileutils.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2025-04-14 21:32:41 +0300
committerGitHub <noreply@github.com>2025-04-14 21:32:41 +0300
commit102f825c5112cbe6985edc0971822b07bd778135 (patch)
tree5505d5ff2d65609e476788d087893ff76edc03bd /Python/fileutils.c
parent61638418a7306723fedf88389c9c5aa540dfb809 (diff)
downloadcpython-102f825c5112cbe6985edc0971822b07bd778135.tar.gz
cpython-102f825c5112cbe6985edc0971822b07bd778135.zip
gh-124476: Fix decoding from the locale encoding in the C.UTF-8 locale (GH-132477)
Diffstat (limited to 'Python/fileutils.c')
-rw-r--r--Python/fileutils.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c
index 95b64ed76fb..78603d40704 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -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;
}