summaryrefslogtreecommitdiff
path: root/py/makemoduledefs.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-04-12 11:34:52 +1000
committerDamien George <damien.p.george@gmail.com>2019-04-12 11:34:52 +1000
commit673e154dfef6aef827b86ea177c211269358b282 (patch)
tree087412b342bfb18af0e7d101b73a737117c90fe8 /py/makemoduledefs.py
parentfd112239d6b7e6ebeb78f62e3b02aa6640a88772 (diff)
py/makedefs: Use io.open with utf-8 encoding when processing source.
In case (user) source code contains utf-8 encoded data and the default locale is not utf-8. See #4592.
Diffstat (limited to 'py/makemoduledefs.py')
-rw-r--r--py/makemoduledefs.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/py/makemoduledefs.py b/py/makemoduledefs.py
index 18d327f00..f17b0e38d 100644
--- a/py/makemoduledefs.py
+++ b/py/makemoduledefs.py
@@ -8,6 +8,7 @@
from __future__ import print_function
import re
+import io
import os
import argparse
@@ -49,7 +50,7 @@ def find_module_registrations(c_file):
# No c file to match the object file, skip
return set()
- with open(c_file) as c_file_obj:
+ with io.open(c_file, encoding='utf-8') as c_file_obj:
return set(re.findall(pattern, c_file_obj.read()))