[commit: ghc] ghc-8.0: Fix check_uniques in non-unicode locale (454542f)

git at git.haskell.org git at git.haskell.org
Fri Jul 8 14:12:53 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/454542ff0e15eb41fc460d151814ffccb43eca84/ghc

>---------------------------------------------------------------

commit 454542ff0e15eb41fc460d151814ffccb43eca84
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Thu Jun 30 10:32:00 2016 +0200

    Fix check_uniques in non-unicode locale
    
    Testcase: `LC_ALL=C make -C utils/checkUniques`. Works with python2 and
    python3.
    
    Reviewed by: bgamari
    
    Differential Revision: https://phabricator.haskell.org/D2372
    
    (cherry picked from commit b65363d3eaffd453ca0790b34a5a4dc4354e176a)


>---------------------------------------------------------------

454542ff0e15eb41fc460d151814ffccb43eca84
 utils/checkUniques/check-uniques.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/utils/checkUniques/check-uniques.py b/utils/checkUniques/check-uniques.py
index 42b375e..67322c2 100755
--- a/utils/checkUniques/check-uniques.py
+++ b/utils/checkUniques/check-uniques.py
@@ -5,6 +5,7 @@ import os.path
 import sys
 import re
 import glob
+import io
 from collections import defaultdict
 
 # keyed on unique type, values are lists of (unique, name) pairs
@@ -12,7 +13,7 @@ def find_uniques(source_files):
     uniques = defaultdict(lambda: defaultdict(lambda: set()))
     unique_re = re.compile(r"([\w\d]+)\s*=\s*mk([\w\d']+)Unique\s+(\d+)")
     for f in source_files:
-        ms = unique_re.findall(open(f).read())
+        ms = unique_re.findall(io.open(f, encoding='utf8').read())
         for m in ms:
             name = m[0]
             _type = m[1]



More information about the ghc-commits mailing list