[Python-checkins] bpo-42351: Avoid error when opening header with non-UTF8 encoding (GH-23279)

ronaldoussoren webhook-mailer at python.org
Sat Nov 14 10:07:51 EST 2020


https://github.com/python/cpython/commit/7a27c7ed4b2b45bb9ea27d3f5c4f423495d6e939
commit: 7a27c7ed4b2b45bb9ea27d3f5c4f423495d6e939
branch: master
author: Ronald Oussoren <ronaldoussoren at mac.com>
committer: ronaldoussoren <ronaldoussoren at mac.com>
date: 2020年11月14日T16:07:47+01:00
summary:
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.
files:
M setup.py
diff --git a/setup.py b/setup.py
index c12b5f5042551..91358af9b616b 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


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /