From 91d8784a046e8dcb11e3a58e228dfd30687f85e3 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Mon, 27 Nov 2017 07:36:13 +0530 Subject: [PATCH] configure_file: Compare difference in binary mode Otherwise Python will try to use string decode on the configured file and fail if it contains characters that can't be mapped to the current encoding. --- mesonbuild/mesonlib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 686f7d93f..a35345b1b 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -534,7 +534,7 @@ def replace_if_different(dst, dst_tmp): # unnecessary rebuilds. different = True try: - with open(dst, 'r') as f1, open(dst_tmp, 'r') as f2: + with open(dst, 'rb') as f1, open(dst_tmp, 'rb') as f2: if f1.read() == f2.read(): different = False except FileNotFoundError: