Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r59407:b80f1edeadb6
Date: 2012-12-11 22:32 +0100
http://bitbucket.org/pypy/pypy/changeset/b80f1edeadb6/

Log:    strftime() now accepts years starting at 1000.

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
@@ -435,7 +435,7 @@
     w_accept2dyear = _get_module_object(space, "accept2dyear")
     accept2dyear = space.int_w(w_accept2dyear)
 
-    if y < 1900:
+    if y < 1000:
         if accept2dyear:
             if 69 <= y <= 99:
                 y += 1900
@@ -444,6 +444,8 @@
             else:
                 raise OperationError(space.w_ValueError,
                                      space.wrap("year out of range"))
+            space.warn("Century info guessed for a 2-digit year.",
+                       space.w_DeprecationWarning)
 
     if rffi.getintfield(glob_buf, 'c_tm_wday') < 0:
         raise OperationError(space.w_ValueError,
diff --git a/pypy/module/rctime/test/test_rctime.py 
b/pypy/module/rctime/test/test_rctime.py
--- a/pypy/module/rctime/test/test_rctime.py
+++ b/pypy/module/rctime/test/test_rctime.py
@@ -255,9 +255,8 @@
         if rctime.accept2dyear:
             raises(ValueError, rctime.strftime, '', (-1, 1, 1, 0, 0, 0, 0, 1, 
-1))
             raises(ValueError, rctime.strftime, '', (100, 1, 1, 0, 0, 0, 0, 1, 
-1))
-        else:
-            rctime.strftime('', (1899, 1, 1, 0, 0, 0, 0, 1, -1))
-            rctime.strftime('', (0, 1, 1, 0, 0, 0, 0, 1, -1))
+        rctime.strftime('', (1899, 1, 1, 0, 0, 0, 0, 1, -1))
+        rctime.strftime('', (0, 1, 1, 0, 0, 0, 0, 1, -1))
 
         # check month
         raises(ValueError, rctime.strftime, '', (1900, 13, 1, 0, 0, 0, 0, 1, 
-1))
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to