diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-19 13:09:57 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-19 13:09:57 (GMT) |
commit | 35de5ac44db5c42c792b71077520a6b3ef29b199 (patch) | |
tree | b9f714bae4121e202f37a4b1520d99cd0b750fc8 /Lib/packaging/command | |
parent | cd0f7bfd3251e8469f311a6a1a9fe1d3d2259bf1 (diff) | |
download | cpython-35de5ac44db5c42c792b71077520a6b3ef29b199.zip cpython-35de5ac44db5c42c792b71077520a6b3ef29b199.tar.gz cpython-35de5ac44db5c42c792b71077520a6b3ef29b199.tar.bz2 |
packaging: don't use locale encoding to compute MD5 checksums
Open the file in binary mode or use UTF-8 encoding.
Diffstat (limited to 'Lib/packaging/command')
-rw-r--r-- | Lib/packaging/command/install_distinfo.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/packaging/command/install_distinfo.py b/Lib/packaging/command/install_distinfo.py index 41fe734..a25a15a 100644 --- a/Lib/packaging/command/install_distinfo.py +++ b/Lib/packaging/command/install_distinfo.py @@ -133,9 +133,9 @@ class install_distinfo(Command): writer.writerow((fpath, '', '')) else: size = os.path.getsize(fpath) - with open(fpath, 'r') as fp: + with open(fpath, 'rb') as fp: hash = hashlib.md5() - hash.update(fp.read().encode()) + hash.update(fp.read()) md5sum = hash.hexdigest() writer.writerow((fpath, md5sum, size)) |