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/create.py | |
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/create.py')
-rw-r--r-- | Lib/packaging/create.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/packaging/create.py b/Lib/packaging/create.py index 837d0b6..0676cf1 100644 --- a/Lib/packaging/create.py +++ b/Lib/packaging/create.py @@ -400,10 +400,10 @@ class MainProgram: self.data['description']).lower().encode()) ref = ref.digest() for readme in glob.glob('README*'): - with open(readme) as fp: + with open(readme, encoding='utf-8') as fp: contents = fp.read() - val = md5(re.sub('\s', '', - contents.lower()).encode()).digest() + contents = re.sub('\s', '', contents.lower()).encode() + val = md5(contents).digest() if val == ref: del data['description'] data['description-file'] = readme |