Commit b65363d3 authored by thomie's avatar thomie

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
parent f1e16e92
......@@ -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]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment