Skip to content

Commit dc342bb

Browse files
authored
Merge pull request #3070 from domdfcoding/isue-3063
Skip non-string values from sysconfig.get_config_vars()
2 parents ff9b0a9 + a3bc3d4 commit dc342bb

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

changelog.d/3070.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Avoid AttributeError in easy_install.create_home_path when sysconfig.get_config_vars values are not strings.

setuptools/command/easy_install.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ def create_home_path(self):
13341334
if not self.user:
13351335
return
13361336
home = convert_path(os.path.expanduser("~"))
1337-
for name, path in self.config_vars.items():
1337+
for path in only_strs(self.config_vars.values()):
13381338
if path.startswith(home) and not os.path.isdir(path):
13391339
self.debug_print("os.makedirs('%s', 0o700)" % path)
13401340
os.makedirs(path, 0o700)
@@ -2304,6 +2304,13 @@ def current_umask():
23042304
return tmp
23052305

23062306

2307+
def only_strs(values):
2308+
"""
2309+
Exclude non-str values. Ref #3063.
2310+
"""
2311+
return filter(lambda val: isinstance(val, str), values)
2312+
2313+
23072314
class EasyInstallDeprecationWarning(SetuptoolsDeprecationWarning):
23082315
"""
23092316
Warning for EasyInstall deprecations, bypassing suppression.

0 commit comments

Comments
 (0)