diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-09-29 11:41:46 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-09-29 11:41:46 (GMT) |
commit | 2bfed53b88cea7a4ec4b45cac33c62d9342796bb (patch) | |
tree | 16860a649299a0785bdf30e82d6d89e8a5d2e8ad /Python/pytime.c | |
parent | c3713e9706e51bbd30958c27d35e7fda764b0c4a (diff) | |
download | cpython-2bfed53b88cea7a4ec4b45cac33c62d9342796bb.zip cpython-2bfed53b88cea7a4ec4b45cac33c62d9342796bb.tar.gz cpython-2bfed53b88cea7a4ec4b45cac33c62d9342796bb.tar.bz2 |
Try to fix _PyTime_AsTimevalStruct_impl() on OpenBSD
It looks like the check for integer overflow doesn't work on x86 OpenBSD 5.8.
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 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; |