https://github.com/python/cpython/commit/bf6fa21a9167df1df73d694dea1754be8d214f28
commit: bf6fa21a9167df1df73d694dea1754be8d214f28
branch: 3.13
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2024-11-14T13:21:27+01:00
summary:
[3.13] gh-126433: Fix compiler warnings on 32-bit Windows (#126444) (#126827)
gh-126433: Fix compiler warnings on 32-bit Windows (#126444)
(cherry picked from commit 0b67ce930a56c4ffd597b1a658ddcbacfb40e798)
files:
M Modules/_interpchannelsmodule.c
M Modules/_ssl.c
M Modules/_winapi.c
M PC/venvlauncher.c
diff --git a/Modules/_interpchannelsmodule.c b/Modules/_interpchannelsmodule.c
index 4c1b4b5a76ce08..5dc032b46cac9a 100644
--- a/Modules/_interpchannelsmodule.c
+++ b/Modules/_interpchannelsmodule.c
@@ -2061,7 +2061,7 @@ _channel_get_info(_channels *channels, int64_t cid,
struct channel_info *info)
if (interp == NULL) {
return -1;
}
- Py_ssize_t interpid = PyInterpreterState_GetID(interp);
+ int64_t interpid = PyInterpreterState_GetID(interp);
// Hold the global lock until we're done.
PyThread_acquire_lock(channels->mutex, WAIT_LOCK);
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 8993a6ccecb213..9e417a6c79c042 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -4707,7 +4707,9 @@ static unsigned int psk_client_callback(SSL *s,
goto error;
}
- if (identity_len_ + 1 > max_identity_len || psk_len_ > max_psk_len) {
+ if ((size_t)identity_len_ + 1 > max_identity_len
+ || (size_t)psk_len_ > max_psk_len)
+ {
Py_DECREF(result);
goto error;
}
@@ -4819,7 +4821,7 @@ static unsigned int psk_server_callback(SSL *s,
goto error;
}
- if (psk_len_ > max_psk_len) {
+ if ((size_t)psk_len_ > max_psk_len) {
Py_DECREF(result);
goto error;
}
diff --git a/Modules/_winapi.c b/Modules/_winapi.c
index 71bddd2f697df4..bd80c5c94fe36d 100644
--- a/Modules/_winapi.c
+++ b/Modules/_winapi.c
@@ -2317,7 +2317,7 @@ _winapi_BatchedWaitForMultipleObjects_impl(PyObject
*module,
BOOL wait_all, DWORD milliseconds)
/*[clinic end generated code: output=d21c1a4ad0a252fd input=7e196f29005dc77b]*/
{
- Py_ssize_t thread_count = 0, handle_count = 0, i, j;
+ Py_ssize_t thread_count = 0, handle_count = 0, i;
Py_ssize_t nhandles;
BatchedWaitData *thread_data[MAXIMUM_WAIT_OBJECTS];
HANDLE handles[MAXIMUM_WAIT_OBJECTS];
@@ -2378,7 +2378,7 @@ _winapi_BatchedWaitForMultipleObjects_impl(PyObject
*module,
if (data->handle_count > MAXIMUM_WAIT_OBJECTS - 1) {
data->handle_count = MAXIMUM_WAIT_OBJECTS - 1;
}
- for (j = 0; j < data->handle_count; ++i, ++j) {
+ for (DWORD j = 0; j < data->handle_count; ++i, ++j) {
PyObject *v = PySequence_GetItem(handle_seq, i);
if (!v || !PyArg_Parse(v, F_HANDLE, &data->handles[j])) {
Py_XDECREF(v);
@@ -2526,7 +2526,7 @@ _winapi_BatchedWaitForMultipleObjects_impl(PyObject
*module,
if (triggered_indices) {
for (i = 0; i < thread_count; ++i) {
Py_ssize_t triggered = (Py_ssize_t)thread_data[i]->result -
WAIT_OBJECT_0;
- if (triggered >= 0 && triggered < thread_data[i]->handle_count
- 1) {
+ if (triggered >= 0 && (size_t)triggered <
thread_data[i]->handle_count - 1) {
PyObject *v =
PyLong_FromSsize_t(thread_data[i]->handle_base + triggered);
if (!v || PyList_Append(triggered_indices, v) < 0) {
Py_XDECREF(v);
diff --git a/PC/venvlauncher.c b/PC/venvlauncher.c
index b1c8d0763d8c76..b6bb0218236ae9 100644
--- a/PC/venvlauncher.c
+++ b/PC/venvlauncher.c
@@ -223,7 +223,7 @@ find_home_value(const char *buffer, DWORD maxlen, const
char **start, DWORD *len
return 0;
}
for (const char *s = strstr(buffer, "home");
- s && ((ptrdiff_t)s - (ptrdiff_t)buffer) < maxlen;
+ s && (size_t)((ptrdiff_t)s - (ptrdiff_t)buffer) < maxlen;
s = strstr(s + 1, "\nhome")
) {
if (*s == '\n') {
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]