[Python-checkins] bpo-39277: Fix PY_TIMEOUT_MAX cast in _threadmodule.c (GH-31195)
vstinner
webhook-mailer at python.org
Mon Feb 7 10:21:14 EST 2022
https://github.com/python/cpython/commit/d3e53bc5321a9f08c7ed5b9383eefb2e03dfa6e2
commit: d3e53bc5321a9f08c7ed5b9383eefb2e03dfa6e2
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2022-02-07T16:21:09+01:00
summary:
bpo-39277: Fix PY_TIMEOUT_MAX cast in _threadmodule.c (GH-31195)
Cast PY_TIMEOUT_MAX to double, not to _PyTime_t.
Fix the clang warning:
Modules/_threadmodule.c:1648:26: warning: implicit conversion from
'_PyTime_t' (aka 'long') to 'double' changes value from
9223372036854775 to 9223372036854776
[-Wimplicit-const-int-float-conversion]
double timeout_max = (_PyTime_t)PY_TIMEOUT_MAX * 1e-6;
^~~~~~~~~~~~~~~~~~~~~~~~~ ~
files:
M Modules/_threadmodule.c
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index 9e6e462b59e06..7052d4c887a66 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -1645,7 +1645,7 @@ thread_module_exec(PyObject *module)
}
// TIMEOUT_MAX
- double timeout_max = (_PyTime_t)PY_TIMEOUT_MAX * 1e-6;
+ double timeout_max = (double)PY_TIMEOUT_MAX * 1e-6;
double time_max = _PyTime_AsSecondsDouble(_PyTime_MAX);
timeout_max = Py_MIN(timeout_max, time_max);
// Round towards minus infinity
More information about the Python-checkins
mailing list