Skip to content

gh-131296: Fix Windows build warnings #131487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Modules/_io/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1293,8 +1293,8 @@ fileio_get_mode(PyObject *op, void *closure)
static PyObject *
fileio_get_blksize(PyObject *op, void *closure)
{
fileio *self = PyFileIO_CAST(op);
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
fileio *self = PyFileIO_CAST(op);
if (self->stat_atopen != NULL && self->stat_atopen->st_blksize > 1) {
return PyLong_FromLong(self->stat_atopen->st_blksize);
}
Expand Down
1 change: 0 additions & 1 deletion Modules/_io/winconsoleio.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ _io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj,
int ret = 0;
int rwa = 0;
int fd = -1;
int fd_is_own = 0;
HANDLE handle = NULL;

#ifndef NDEBUG
Expand Down
1 change: 0 additions & 1 deletion Modules/faulthandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ faulthandler_exc_handler(struct _EXCEPTION_POINTERS *exc_info)
{
const int fd = fatal_error.fd;
DWORD code = exc_info->ExceptionRecord->ExceptionCode;
DWORD flags = exc_info->ExceptionRecord->ExceptionFlags;

if (faulthandler_ignore_exception(code)) {
/* ignore the exception: call the next exception handler */
Expand Down
1 change: 0 additions & 1 deletion Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -5696,7 +5696,6 @@ os_mkdir_impl(PyObject *module, path_t *path, int mode, int dir_fd)
int result;
#ifdef MS_WINDOWS
int error = 0;
int pathError = 0;
SECURITY_ATTRIBUTES secAttr = { sizeof(secAttr) };
SECURITY_ATTRIBUTES *pSecAttr = NULL;
#endif
Expand Down
4 changes: 1 addition & 3 deletions PC/winreg.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ static BOOL clinic_HKEY_converter(winreg_state *st, PyObject *ob, void *p);
static PyObject *PyHKEY_FromHKEY(winreg_state *st, HKEY h);
static BOOL PyHKEY_Close(winreg_state *st, PyObject *obHandle);

static char errNotAHandle[] = "Object is not a handle";

/* The win32api module reports the function name that failed,
but this concept is not in the Python core.
Hopefully it will one day, and in the meantime I don't
Expand Down Expand Up @@ -2074,7 +2072,7 @@ static struct PyMethodDef winreg_methods[] = {
WINREG_SAVEKEY_METHODDEF
WINREG_SETVALUE_METHODDEF
WINREG_SETVALUEEX_METHODDEF
NULL,
{NULL},
};

#define ADD_INT(VAL) do { \
Expand Down
4 changes: 4 additions & 0 deletions Python/fileutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -129,13 +131,15 @@ 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,
// it creates characters outside the [U+0000; U+10ffff] range:
// https://sourceware.org/bugzilla/show_bug.cgi?id=2373
return 0;
}
#endif
return 1;
}

Expand Down
2 changes: 2 additions & 0 deletions Python/sysmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2531,7 +2531,9 @@ sys__is_gil_enabled_impl(PyObject *module)
}


#ifndef MS_WINDOWS
static PerfMapState perf_map_state;
#endif

PyAPI_FUNC(int) PyUnstable_PerfMapState_Init(void) {
#ifndef MS_WINDOWS
Expand Down
Loading