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.
This commit is contained in:
parent
2b39da4997
commit
7a27c7ed4b
2
setup.py
2
setup.py
|
@ -241,7 +241,7 @@ def is_macosx_sdk_path(path):
|
||||||
|
|
||||||
def grep_headers_for(function, headers):
|
def grep_headers_for(function, headers):
|
||||||
for header in headers:
|
for header in headers:
|
||||||
with open(header, 'r') as f:
|
with open(header, 'r', errors='surrogateescape') as f:
|
||||||
if function in f.read():
|
if function in f.read():
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue