diff options
author | Mathieu Bridon <[email protected]> | 2018-08-17 21:32:16 +0200 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2018-08-22 08:41:01 -0700 |
commit | fc708069f74063428e90595f494de6c79515f64e (patch) | |
tree | d50db388c97405d78caf4641e3ba3d6cb0610487 /src | |
parent | 477d4b9960ae8b7524806a9dff1d91b0546ec0f2 (diff) |
python: difflib prefers unicode strings
Python 3 does not automatically convert from bytes to unicode strings
like Python 2 used to do.
This commit makes sure we pass unicode strings to difflib.unified_diff,
so that the script works on both Python 2 and 3.
Reviewed-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src')
-rwxr-xr-x | src/compiler/glsl/glcpp/tests/glcpp_test.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/glsl/glcpp/tests/glcpp_test.py b/src/compiler/glsl/glcpp/tests/glcpp_test.py index 8ac5d7cb0a1..e27391093cf 100755 --- a/src/compiler/glsl/glcpp/tests/glcpp_test.py +++ b/src/compiler/glsl/glcpp/tests/glcpp_test.py @@ -64,8 +64,9 @@ def test_output(glcpp, filename, expfile, nl_format='\n'): stderr=subprocess.STDOUT, stdin=subprocess.PIPE) actual, _ = proc.communicate(f.read()) + actual = actual.decode('utf-8') - with open(expfile, 'rb') as f: + with open(expfile, 'r') as f: expected = f.read() if actual == expected: |