diff options
author | Armin Rigo <arigo@tunes.org> | 2011-08-02 20:48:34 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2011-08-02 20:48:34 +0200 |
commit | 48a0d6adc00cf11c65330775e61e1aee869b8c46 (patch) | |
tree | 2d2c0590ab84b19d376bf31dc82bbe299111ca55 | |
parent | merge heads (diff) | |
download | pypy-48a0d6adc00cf11c65330775e61e1aee869b8c46.tar.gz pypy-48a0d6adc00cf11c65330775e61e1aee869b8c46.tar.bz2 pypy-48a0d6adc00cf11c65330775e61e1aee869b8c46.zip |
Fix for OpenBSD 64.
-rw-r--r-- | pypy/module/rctime/interp_time.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/pypy/module/rctime/interp_time.py b/pypy/module/rctime/interp_time.py index c3d4cefbcc..6bc8efe626 100644 --- a/pypy/module/rctime/interp_time.py +++ b/pypy/module/rctime/interp_time.py @@ -207,13 +207,13 @@ def _init_timezone(space): t = (((c_time(lltype.nullptr(rffi.TIME_TP.TO))) / YEAR) * YEAR) # we cannot have reference to stack variable, put it on the heap t_ref = lltype.malloc(rffi.TIME_TP.TO, 1, flavor='raw') - t_ref[0] = t + t_ref[0] = rffi.cast(rffi.TIME_T, t) p = c_localtime(t_ref) janzone = -p.c_tm_gmtoff tm_zone = rffi.charp2str(p.c_tm_zone) janname = [" ", tm_zone][bool(tm_zone)] tt = t + YEAR / 2 - t_ref[0] = tt + t_ref[0] = rffi.cast(rffi.TIME_T, tt) p = c_localtime(t_ref) lltype.free(t_ref, flavor='raw') tm_zone = rffi.charp2str(p.c_tm_zone) @@ -292,11 +292,14 @@ def _get_inttime(space, w_seconds): else: seconds = space.float_w(w_seconds) try: - ovfcheck_float_to_int(seconds) + seconds = ovfcheck_float_to_int(seconds) + t = rffi.r_time_t(seconds) + if rffi.cast(lltype.Signed, t) != seconds: + raise OverflowError except OverflowError: raise OperationError(space.w_ValueError, space.wrap("time argument too large")) - return rffi.r_time_t(seconds) + return t def _tm_to_tuple(space, t): time_tuple = [ |