[Bug 5194] New: importing crecord.py changes locale environment, breaks date parsing/formatting

mercurial-bugs at selenic.com mercurial-bugs at selenic.com
Sat Apr 9 04:59:20 UTC 2016


https://bz.mercurial-scm.org/show_bug.cgi?id=5194

            Bug ID: 5194
           Summary: importing crecord.py changes locale environment,
                    breaks date parsing/formatting
           Product: Mercurial
           Version: default branch
          Hardware: PC
                OS: Windows
            Status: UNCONFIRMED
          Severity: bug
          Priority: normal
         Component: record
          Assignee: bugzilla at selenic.com
          Reporter: yuya at tcha.org
                CC: adrian at cadifra.com, mercurial-devel at selenic.com

crecord.py initializes the locale to the user's default, which changes
date formatting (and perhaps parsing.)

https://selenic.com/repo/hg/file/3.7.3/mercurial/crecord.py#l32

On Japanese Windows XP (32bit), I got the following test failure because
"Sep" isn't a valid month on Japanese locale of Windows.

$ ./run-tests.py -l test-doctest.py
--- z:/work/hghacks/mercurial-work/tests/test-doctest.py.out
+++ z:/work/hghacks/mercurial-work/tests/test-doctest.py.err
@@ -0,0 +1,28 @@
+**********************************************************************
+File "z:\work\hghacks\mercurial-work\mercurial\util.py", line 1745, in
mercurial.util.matchdate
+Failed example:
+    p5 = parsedate("Sep 15 10:30:00 1999")
+Exception raised:
+    Traceback (most recent call last):
+      File "c:\Python27\lib\doctest.py", line 1315, in __run
+        compileflags, 1) in test.globs
+      File "<doctest mercurial.util.matchdate[4]>", line 1, in <module>
+        p5 = parsedate("Sep 15 10:30:00 1999")
+      File "z:\work\hghacks\mercurial-work\mercurial\util.py", line 1717, in
parsedate
+        raise Abort(_('invalid date: %r') % date)
+    Abort: invalid date: 'Sep 15 10:30:00 1999'

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list