diff options
author | Daniel G. Taylor <danielgtaylor@gmail.com> | 2014-08-04 13:52:21 -0700 |
---|---|---|
committer | Daniel G. Taylor <danielgtaylor@gmail.com> | 2014-08-04 13:52:35 -0700 |
commit | 35f10f2293b1d015f6aa36e84be10c46b816df90 (patch) | |
tree | 8e329d49ea8487eb644d95366f6d461894769c8e /boto/glacier | |
parent | 7f7cfdbad733ff5b3cafd98a5ccabcfc9d562bca (diff) | |
download | boto-35f10f2293b1d015f6aa36e84be10c46b816df90.tar.gz |
Add comment about encoding [ci skip]
Diffstat (limited to 'boto/glacier')
-rw-r--r-- | boto/glacier/utils.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/boto/glacier/utils.py b/boto/glacier/utils.py index e9cb512e..98847e3f 100644 --- a/boto/glacier/utils.py +++ b/boto/glacier/utils.py @@ -132,6 +132,9 @@ def compute_hashes_from_fileobj(fileobj, chunk_size=1024 * 1024): chunks = [] chunk = fileobj.read(chunk_size) while chunk: + # It's possible to get a file-like object that has no mode (checked + # above) and returns something other than bytes (e.g. str). So here + # we try to catch that and encode to bytes. if not isinstance(chunk, bytes): chunk = chunk.encode(getattr(fileobj, 'encoding', '') or 'utf-8') linear_hash.update(chunk) |