From: Ronald Oussoren Date: Sat, 14 Nov 2020 15:07:47 +0000 (+0100) Subject: bpo-42351: Avoid error when opening header with non-UTF8 encoding (GH-23279) X-Git-Tag: v3.10.0a3~202 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a27c7ed4b2b45bb9ea27d3f5c4f423495d6e939;p=thirdparty%2FPython%2Fcpython.git bpo-42351: Avoid error when opening header with non-UTF8 encoding (GH-23279) grep_headers_for() would error out when a header contained text that cannot be interpreted as UTF-8. --- diff --git a/setup.py b/setup.py index c12b5f504255..91358af9b616 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