From 102f825c5112cbe6985edc0971822b07bd778135 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 14 Apr 2025 21:32:41 +0300 Subject: gh-124476: Fix decoding from the locale encoding in the C.UTF-8 locale (GH-132477) --- Python/fileutils.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'Python/fileutils.c') 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; } -- cgit v1.2.3