From 724d9e3418f858953b0f91db1a0b4924c87cb240 Mon Sep 17 00:00:00 2001 From: Ronald Oussoren Date: Sat, 14 Nov 2020 12:17:16 +0100 Subject: [PATCH] bpo-42351: Avoid error when opening header with non-UTF8 encoding grep_headers_for() would error out when a header contained text that cannot be interpreted as UTF-8. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c12b5f5042551a..91358af9b616b2 100644 --- a/setup.py +++ b/setup.py @@ -241,7 +241,7 @@ def is_macosx_sdk_path(path): def grep_headers_for(function, headers): for header in headers: - with open(header, 'r') as f: + with open(header, 'r', errors='surrogateescape') as f: if function in f.read(): return True return False