diff options
author | Inada Naoki <songofacandy@gmail.com> | 2021-04-06 01:01:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-06 01:01:11 (GMT) |
commit | 3d4af4a876e679431c6a3751667ded63cc6f66c1 (patch) | |
tree | b3e7048cf49888b26716e162471bec2563c205ec /Lib/sysconfig.py | |
parent | 7bc25ec7276db2a81e7823671a74eeb8aa6b4542 (diff) | |
download | cpython-3d4af4a876e679431c6a3751667ded63cc6f66c1.zip cpython-3d4af4a876e679431c6a3751667ded63cc6f66c1.tar.gz cpython-3d4af4a876e679431c6a3751667ded63cc6f66c1.tar.bz2 |
bpo-43651: Fix EncodingWarning in sysconfig (GH-25192)
Diffstat (limited to 'Lib/sysconfig.py')
-rw-r--r-- | Lib/sysconfig.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index 507c51f..b8b1aca 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -240,7 +240,8 @@ def _parse_makefile(filename, vars=None): done = {} notdone = {} - with open(filename, errors="surrogateescape") as f: + with open(filename, encoding=sys.getfilesystemencoding(), + errors="surrogateescape") as f: lines = f.readlines() for line in lines: @@ -388,7 +389,7 @@ def _generate_posix_vars(): # load the installed pyconfig.h: config_h = get_config_h_filename() try: - with open(config_h) as f: + with open(config_h, encoding="utf-8") as f: parse_config_h(f, vars) except OSError as e: msg = "invalid Python installation: unable to open %s" % config_h |