diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-10-01 06:44:03 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-10-01 06:44:03 (GMT) |
commit | b7a8af20ff09efdfa6896ecaff7d036562c17897 (patch) | |
tree | 11b94a30c8af65d5de222639341ab2db6df680a6 /Python | |
parent | 0d30940dd256da65c91c3bb2d1e135f90eb8c223 (diff) | |
download | cpython-b7a8af20ff09efdfa6896ecaff7d036562c17897.zip cpython-b7a8af20ff09efdfa6896ecaff7d036562c17897.tar.gz cpython-b7a8af20ff09efdfa6896ecaff7d036562c17897.tar.bz2 |
Fix _PyTime_AsTimevalStruct_impl() on OpenBSD
On the x86 OpenBSD 5.8 buildbot, the integer overflow check is ignored. Copy
the tv_sec variable into a Py_time_t variable instead of "simply" casting it to
Py_time_t, to fix the integer overflow check.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pytime.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/pytime.c b/Python/pytime.c index 9889a3b..53611b1 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -454,7 +454,7 @@ static int _PyTime_AsTimevalStruct_impl(_PyTime_t t, struct timeval *tv, _PyTime_round_t round, int raise) { - _PyTime_t secs; + _PyTime_t secs, secs2; int us; int res; @@ -467,7 +467,8 @@ _PyTime_AsTimevalStruct_impl(_PyTime_t t, struct timeval *tv, #endif tv->tv_usec = us; - if (res < 0 || (_PyTime_t)tv->tv_sec != secs) { + secs2 = (_PyTime_t)tv->tv_sec; + if (res < 0 || secs2 != secs) { if (raise) error_time_t_overflow(); return -1; |