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;
                         ^~~~~~~~~~~~~~~~~~~~~~~~~ ~
This commit is contained in:
Victor Stinner 2022-02-07 16:21:09 +01:00 committed by GitHub
parent 4b603f6282
commit d3e53bc532
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1645,7 +1645,7 @@ thread_module_exec(PyObject *module)
} }
// TIMEOUT_MAX // 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); double time_max = _PyTime_AsSecondsDouble(_PyTime_MAX);
timeout_max = Py_MIN(timeout_max, time_max); timeout_max = Py_MIN(timeout_max, time_max);
// Round towards minus infinity // Round towards minus infinity