mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-29 23:37:44 +01:00
Explicitly specify encoding when opening text files in Python code
This commit is contained in:
@@ -213,7 +213,7 @@ def main():
|
||||
# Read config generated by configure.
|
||||
config = configparser.ConfigParser()
|
||||
configfile = os.path.abspath(os.path.dirname(__file__)) + "/../config.ini"
|
||||
config.read_file(open(configfile))
|
||||
config.read_file(open(configfile, encoding="utf8"))
|
||||
|
||||
passon_args.append("--configfile=%s" % configfile)
|
||||
|
||||
@@ -590,7 +590,7 @@ class RPCCoverage():
|
||||
if not os.path.isfile(coverage_ref_filename):
|
||||
raise RuntimeError("No coverage reference found")
|
||||
|
||||
with open(coverage_ref_filename, 'r') as coverage_ref_file:
|
||||
with open(coverage_ref_filename, 'r', encoding="utf8") as coverage_ref_file:
|
||||
all_cmds.update([line.strip() for line in coverage_ref_file.readlines()])
|
||||
|
||||
for root, dirs, files in os.walk(self.dir):
|
||||
@@ -599,7 +599,7 @@ class RPCCoverage():
|
||||
coverage_filenames.add(os.path.join(root, filename))
|
||||
|
||||
for filename in coverage_filenames:
|
||||
with open(filename, 'r') as coverage_file:
|
||||
with open(filename, 'r', encoding="utf8") as coverage_file:
|
||||
covered_cmds.update([line.strip() for line in coverage_file.readlines()])
|
||||
|
||||
return all_cmds - covered_cmds
|
||||
|
||||
Reference in New Issue
Block a user