From 6d9e404673ef2d309ab025535c189254acb8b172 Mon Sep 17 00:00:00 2001 From: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> Date: Sat, 15 Mar 2025 20:00:49 +0100 Subject: [PATCH] fix clang-cl warnings in fileutils.c --- Python/fileutils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Python/fileutils.c b/Python/fileutils.c index 68d24bc6b93465..44409d933fa875 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -55,8 +55,9 @@ int _Py_open_cloexec_works = -1; // mbstowcs() and mbrtowc() errors static const size_t DECODE_ERROR = ((size_t)-1); +#ifdef HAVE_MBRTOWC static const size_t INCOMPLETE_CHARACTER = (size_t)-2; - +#endif static int get_surrogateescape(_Py_error_handler errors, int *surrogateescape) @@ -129,7 +130,7 @@ is_valid_wide_char(wchar_t ch) // Reject lone surrogate characters return 0; } - if (ch > MAX_UNICODE) { + if (sizeof(ch) > 2 && ch > MAX_UNICODE) { // bpo-35883: Reject characters outside [U+0000; U+10ffff] range. // The glibc mbstowcs() UTF-8 decoder does not respect the RFC 3629, // it creates characters outside the [U+0000; U+10ffff] range: