Skip to content
Snippets Groups Projects
Commit a71df208 authored by Mathieu Bridon's avatar Mathieu Bridon Committed by Eric Engestrom
Browse files

python: Explicitly use byte strings


In both Python 2 and 3, zlib.Compress.compress() takes a byte string,
and returns a byte string as well.

In Python 2, the script was working because:

1. string literalls were byte strings;
2. opening a file in unicode mode, reading from it, then passing the
   unicode string to compress() would automatically encode to a byte
   string;

On Python 3, the above two points are not valid any more, so:

1. zlib.Compress.compress() refuses the passed unicode string;
2. compressed_data, defined as an empty unicode string literal, can't be
   concatenated with the byte string returned by compress();

This commit fixes this by explicitly using byte strings where
appropriate, so that the script works on both Python 2 and 3.

Signed-off-by: default avatarMathieu Bridon <bochecha@daitauha.fr>
Reviewed-by: default avatarEric Engestrom <eric.engestrom@intel.com>
parent 8678fe53
No related branches found
Tags mesa-17.1.0
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment