Skip to content

Commit f218549

Browse files
[3.13] pythongh-124476: Fix decoding from the locale encoding in the C.UTF-8 locale (pythonGH-132477) (ПР-132528)
(cherry picked from commit 102f825)
1 parent bdff88b commit f218549

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix decoding from the locale encoding in the C.UTF-8 locale.

Python/fileutils.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -523,15 +523,7 @@ decode_current_locale(const char* arg, wchar_t **wstr, size_t *wlen,
523523
break;
524524
}
525525

526-
if (converted == INCOMPLETE_CHARACTER) {
527-
/* Incomplete character. This should never happen,
528-
since we provide everything that we have -
529-
unless there is a bug in the C library, or I
530-
misunderstood how mbrtowc works. */
531-
goto decode_error;
532-
}
533-
534-
if (converted == DECODE_ERROR) {
526+
if (converted == DECODE_ERROR || converted == INCOMPLETE_CHARACTER) {
535527
if (!surrogateescape) {
536528
goto decode_error;
537529
}

0 commit comments

Comments
 (0)