Skip to content

Commit 6d9e404

Browse files
committed
fix clang-cl warnings in fileutils.c
1 parent 7ae9c5d commit 6d9e404

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Python/fileutils.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ int _Py_open_cloexec_works = -1;
5555

5656
// mbstowcs() and mbrtowc() errors
5757
static const size_t DECODE_ERROR = ((size_t)-1);
58+
#ifdef HAVE_MBRTOWC
5859
static const size_t INCOMPLETE_CHARACTER = (size_t)-2;
59-
60+
#endif
6061

6162
static int
6263
get_surrogateescape(_Py_error_handler errors, int *surrogateescape)
@@ -129,7 +130,7 @@ is_valid_wide_char(wchar_t ch)
129130
// Reject lone surrogate characters
130131
return 0;
131132
}
132-
if (ch > MAX_UNICODE) {
133+
if (sizeof(ch) > 2 && ch > MAX_UNICODE) {
133134
// bpo-35883: Reject characters outside [U+0000; U+10ffff] range.
134135
// The glibc mbstowcs() UTF-8 decoder does not respect the RFC 3629,
135136
// it creates characters outside the [U+0000; U+10ffff] range:

0 commit comments

Comments
 (0)