[pypy-commit] pypy fix-e4fa0b2: fix changes made in e4fa0b2: still need the check before because modulo wipes negative
bdkearns
noreply at buildbot.pypy.org
Thu Jan 24 18:43:02 CET 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch: fix-e4fa0b2
Changeset: r60427:269fdb562619
Date: 2013-01-24 01:18 -0500
http://bitbucket.org/pypy/pypy/changeset/269fdb562619/
Log: fix changes made in e4fa0b2: still need the check before because
modulo wipes negative
diff --git a/pypy/module/rctime/interp_time.py b/pypy/module/rctime/interp_time.py
--- a/pypy/module/rctime/interp_time.py
+++ b/pypy/module/rctime/interp_time.py
@@ -448,6 +448,12 @@
raise OperationError(space.w_ValueError,
space.wrap("year out of range"))
+ # tm_wday does not need checking of its upper-bound since taking "%
+ # 7" in gettmarg() automatically restricts the range.
+ if rffi.getintfield(glob_buf, 'c_tm_wday') < -1:
+ raise OperationError(space.w_ValueError,
+ space.wrap("day of week out of range"))
+
rffi.setintfield(glob_buf, 'c_tm_year', y - 1900)
rffi.setintfield(glob_buf, 'c_tm_mon',
rffi.getintfield(glob_buf, 'c_tm_mon') - 1)
@@ -456,12 +462,6 @@
rffi.setintfield(glob_buf, 'c_tm_yday',
rffi.getintfield(glob_buf, 'c_tm_yday') - 1)
- # tm_wday does not need checking of its upper-bound since taking "%
- # 7" in gettmarg() automatically restricts the range.
- if rffi.getintfield(glob_buf, 'c_tm_wday') < 0:
- raise OperationError(space.w_ValueError,
- space.wrap("day of week out of range"))
-
return glob_buf
def time(space):
More information about the pypy-commit
mailing list