summaryrefslogtreecommitdiffstats
path: root/Lib/sysconfig.py
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2021-02-01 03:29:44 (GMT)
committerGitHub <noreply@github.com>2021-02-01 03:29:44 (GMT)
commit49926cf2bcc8b44d9b8f148d81979ada191dd9d5 (patch)
treebe9a04e3ca1007a0230b6dcf2cbab176aead735e /Lib/sysconfig.py
parenta776da90b8f2a1342f4f9bfd23a62cea9a0497c6 (diff)
downloadcpython-49926cf2bcc8b44d9b8f148d81979ada191dd9d5.zip
cpython-49926cf2bcc8b44d9b8f148d81979ada191dd9d5.tar.gz
cpython-49926cf2bcc8b44d9b8f148d81979ada191dd9d5.tar.bz2
bpo-42504: Ensure that get_config_var('MACOSX_DEPLOYMENT_TARGET') is a string (GH-24341)
* bpo-42504: Ensure that get_config_var('MACOSX_DEPLOYMENT_TARGET') is a string
Diffstat (limited to 'Lib/sysconfig.py')
-rw-r--r--Lib/sysconfig.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index c1aaf79..507c51f 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -18,6 +18,11 @@ __all__ = [
'parse_config_h',
]
+# Keys for get_config_var() that are never converted to Python integers.
+_ALWAYS_STR = {
+ 'MACOSX_DEPLOYMENT_TARGET',
+}
+
_INSTALL_SCHEMES = {
'posix_prefix': {
'stdlib': '{installed_base}/{platlibdir}/python{py_version_short}',
@@ -252,6 +257,9 @@ def _parse_makefile(filename, vars=None):
notdone[n] = v
else:
try:
+ if n in _ALWAYS_STR:
+ raise ValueError
+
v = int(v)
except ValueError:
# insert literal `$'
@@ -310,6 +318,8 @@ def _parse_makefile(filename, vars=None):
notdone[name] = value
else:
try:
+ if name in _ALWAYS_STR:
+ raise ValueError
value = int(value)
except ValueError:
done[name] = value.strip()
@@ -472,6 +482,8 @@ def parse_config_h(fp, vars=None):
if m:
n, v = m.group(1, 2)
try:
+ if n in _ALWAYS_STR:
+ raise ValueError
v = int(v)
except ValueError:
pass