Skip to content

Commit 2bfed53

Browse files
committed
Try to fix _PyTime_AsTimevalStruct_impl() on OpenBSD
It looks like the check for integer overflow doesn't work on x86 OpenBSD 5.8.
1 parent c3713e9 commit 2bfed53

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Python/pytime.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ static int
454454
_PyTime_AsTimevalStruct_impl(_PyTime_t t, struct timeval *tv,
455455
_PyTime_round_t round, int raise)
456456
{
457-
_PyTime_t secs;
457+
_PyTime_t secs, secs2;
458458
int us;
459459
int res;
460460

@@ -467,7 +467,8 @@ _PyTime_AsTimevalStruct_impl(_PyTime_t t, struct timeval *tv,
467467
#endif
468468
tv->tv_usec = us;
469469

470-
if (res < 0 || (_PyTime_t)tv->tv_sec != secs) {
470+
secs2 = (_PyTime_t)tv->tv_sec;
471+
if (res < 0 || secs2 != secs) {
471472
if (raise)
472473
error_time_t_overflow();
473474
return -1;

0 commit comments

Comments
 (0)