Skip to content
Merged
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
bpo-39277: Fix PY_TIMEOUT_MAX cast in _threadmodule.c
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;
                         ^~~~~~~~~~~~~~~~~~~~~~~~~ ~
  • Loading branch information
vstinner committed Feb 7, 2022
commit ce0b74fc34bcbb7d4581ea8b21200e58fa33ff52
2 changes: 1 addition & 1 deletion Modules/_threadmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down