Commits

Brian Kearns committed 269fdb5

fix changes made in e4fa0b2: still need the check before because modulo wipes negative

Comments (0)

Files changed (1)

pypy/module/rctime/interp_time.py

             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)
     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):