Skip to content

Commit 3d4af4a

Browse files
authored
bpo-43651: Fix EncodingWarning in sysconfig (GH-25192)
1 parent 7bc25ec commit 3d4af4a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/sysconfig.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ def _parse_makefile(filename, vars=None):
240240
done = {}
241241
notdone = {}
242242

243-
with open(filename, errors="surrogateescape") as f:
243+
with open(filename, encoding=sys.getfilesystemencoding(),
244+
errors="surrogateescape") as f:
244245
lines = f.readlines()
245246

246247
for line in lines:
@@ -388,7 +389,7 @@ def _generate_posix_vars():
388389
# load the installed pyconfig.h:
389390
config_h = get_config_h_filename()
390391
try:
391-
with open(config_h) as f:
392+
with open(config_h, encoding="utf-8") as f:
392393
parse_config_h(f, vars)
393394
except OSError as e:
394395
msg = "invalid Python installation: unable to open %s" % config_h

0 commit comments

Comments
 (0)