From 3e396b3782813d36d46195564cd0e111422bcaf5 Mon Sep 17 00:00:00 2001 From: Daniel Mensinger Date: Tue, 22 Jun 2021 22:59:16 +0200 Subject: fix: Always explicitly set encoding for text files (fixes #8263) --- mesonbuild/dependencies/cuda.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mesonbuild/dependencies/cuda.py') diff --git a/mesonbuild/dependencies/cuda.py b/mesonbuild/dependencies/cuda.py index 43bb622..21cc7ab 100644 --- a/mesonbuild/dependencies/cuda.py +++ b/mesonbuild/dependencies/cuda.py @@ -184,7 +184,7 @@ class CudaDependency(SystemDependency): def _read_cuda_runtime_api_version(self, path_str: str) -> T.Optional[str]: path = Path(path_str) for i in path.rglob('cuda_runtime_api.h'): - raw = i.read_text() + raw = i.read_text(encoding='utf-8') m = self.cudart_version_regex.search(raw) if not m: continue @@ -202,7 +202,7 @@ class CudaDependency(SystemDependency): # Read 'version.txt' at the root of the CUDA Toolkit directory to determine the tookit version version_file_path = os.path.join(path, 'version.txt') try: - with open(version_file_path) as version_file: + with open(version_file_path, encoding='utf-8') as version_file: version_str = version_file.readline() # e.g. 'CUDA Version 10.1.168' m = self.toolkit_version_regex.match(version_str) if m: -- cgit v1.1