From 486d5370653d86aba4348067bd61b973297c22c3 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 20 Mar 2025 12:03:20 +0100 Subject: Fix Windows build warnings (#131487) Fix the following warnings: * Modules\_io\fileio.c(1296,13): unused variable 'self' * Modules\_io\winconsoleio.c(334,9): unused variable 'fd_is_own' * Modules\faulthandler.c(409,11): unused variable 'flags' * Modules\posixmodule.c(5699,9): unused variable 'pathError' * PC\winreg.c(2077,5): suggest braces around initialization of subobject * PC\winreg.c(34,13): unused variable 'errNotAHandle' * Python\fileutils.c(132,12): result of comparison of constant 1114111 with expression of type 'wchar_t' (aka 'unsigned short') is always false * Python\fileutils.c(58,21): unused variable 'INCOMPLETE_CHARACTER' * Python\sysmodule.c(2534,21): unused variable 'perf_map_state' --- Python/fileutils.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Python/fileutils.c') diff --git a/Python/fileutils.c b/Python/fileutils.c index 68d24bc6b93..95b64ed76fb 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -55,7 +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 @@ -129,6 +131,7 @@ is_valid_wide_char(wchar_t ch) // Reject lone surrogate characters return 0; } +#if SIZEOF_WCHAR_T > 2 if (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, @@ -136,6 +139,7 @@ is_valid_wide_char(wchar_t ch) // https://sourceware.org/bugzilla/show_bug.cgi?id=2373 return 0; } +#endif return 1; } -- cgit v1.2.3