Skip to content

Commit c319eee

Browse files
authored
Fix CID-1420310: cast PY_TIMEOUT_MAX to _Py_time_t (#4646)
Fix the following false-alarm Coverity warning: Result is not floating-point (UNINTENDED_INTEGER_DIVISION)integer_division: Dividing integer expressions 9223372036854775807LL and 1000LL, and then converting the integer quotient to type double. Any remainder, or fractional part of the quotient, is ignored. To compute and use a non-integer quotient, change or cast either operand to type double. If integer division is intended, consider indicating that by casting the result to type long long .
1 parent 3be3b97 commit c319eee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/_threadmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ PyInit__thread(void)
13631363
if (m == NULL)
13641364
return NULL;
13651365

1366-
timeout_max = (double)PY_TIMEOUT_MAX * 1e-6;
1366+
timeout_max = (_PyTime_t)PY_TIMEOUT_MAX * 1e-6;
13671367
time_max = _PyTime_AsSecondsDouble(_PyTime_MAX);
13681368
timeout_max = Py_MIN(timeout_max, time_max);
13691369
/* Round towards minus infinity */

0 commit comments

Comments
 (0)