diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-06-16 15:21:01 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-06-16 15:23:14 +0200 |
commit | a90ca4087a6f0d7a0e22ce2769f3b0588d75b293 (patch) | |
tree | 8fafac9487709f7c9c80b0b46ef84235b258946a /contrib/linearize/linearize-data.py | |
parent | fa2ea37940edb407a0fed547bbb93d753240263a (diff) | |
parent | c8176b3cc7556d7bcec39a55ae4d6ba16453baaa (diff) | |
download | bitcoin-a90ca4087a6f0d7a0e22ce2769f3b0588d75b293.tar.xz |
Merge #13448: Add linter: Make sure we explicitly open all text files using UTF-8 encoding in Python
c8176b3cc7556d7bcec39a55ae4d6ba16453baaa Add linter: Make sure we explicitly open all text files using UTF-8 or ASCII encoding in Python (practicalswift)
634bd970013eca90f4b4c1f9044eec8c97ba62c2 Explicitly specify encoding when opening text files in Python code (practicalswift)
Pull request description:
Add linter: Make sure we explicitly open all text files using UTF-8 encoding in Python.
As requested by @laanwj in #13440.
Tree-SHA512: 1651c00fe220ceb273324abd6703aee504029b96c7ef0e3029145901762c733c9b9d24927da281394fd4681a5bff774336c04eed01fafea997bb32192c334c06
Diffstat (limited to 'contrib/linearize/linearize-data.py')
-rwxr-xr-x | contrib/linearize/linearize-data.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/linearize/linearize-data.py b/contrib/linearize/linearize-data.py index f8aea27342..b501388fd2 100755 --- a/contrib/linearize/linearize-data.py +++ b/contrib/linearize/linearize-data.py @@ -75,7 +75,7 @@ def get_blk_dt(blk_hdr): # When getting the list of block hashes, undo any byte reversals. def get_block_hashes(settings): blkindex = [] - f = open(settings['hashlist'], "r") + f = open(settings['hashlist'], "r", encoding="utf8") for line in f: line = line.rstrip() if settings['rev_hash_bytes'] == 'true': @@ -261,7 +261,7 @@ if __name__ == '__main__': print("Usage: linearize-data.py CONFIG-FILE") sys.exit(1) - f = open(sys.argv[1]) + f = open(sys.argv[1], encoding="utf8") for line in f: # skip comment lines m = re.search('^\s*#', line) |