Author: Brian Kearns <[email protected]>
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):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit