diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-10-01 08:44:03 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-10-01 08:44:03 +0200 |
commit | c879d2c9d9e1633e31e70e0e4e4f5e79dcc87709 (patch) | |
tree | e27e7185a958b0d9af38e7d0e568043ea44776a6 /Python/pytime.c | |
parent | 82e2c7f7249cd1820bcba75ab32078cacece8f30 (diff) | |
download | cpython-c879d2c9d9e1633e31e70e0e4e4f5e79dcc87709.tar.gz |
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/pytime.c')
-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 9889a3b53b..53611b1ec1 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; |