aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-01-23 18:49:52 -0500
committerJason R. Coombs <jaraco@jaraco.com>2016-01-23 18:49:52 -0500
commit9363ee420bd803f333b31466796ff00a183de66e (patch)
tree6236038825612f03f51fa96d98a1389b3717f3c5
parent25a12d49012ef636eb5cc929163f89188b084c3f (diff)
downloadexternal_python_setuptools-9363ee420bd803f333b31466796ff00a183de66e.tar.gz
external_python_setuptools-9363ee420bd803f333b31466796ff00a183de66e.tar.bz2
external_python_setuptools-9363ee420bd803f333b31466796ff00a183de66e.zip
Extract variable for candidate encodings
-rw-r--r--setuptools/unicode_utils.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/setuptools/unicode_utils.py b/setuptools/unicode_utils.py
index 18903d9e..6eee6351 100644
--- a/setuptools/unicode_utils.py
+++ b/setuptools/unicode_utils.py
@@ -22,11 +22,13 @@ def filesys_decode(path):
NONE when no expected encoding works
"""
- fs_enc = sys.getfilesystemencoding()
if isinstance(path, six.text_type):
return path
- for enc in (fs_enc, "utf-8"):
+ fs_enc = sys.getfilesystemencoding()
+ candidates = fs_enc, 'utf-8'
+
+ for enc in candidates:
try:
return path.decode(enc)
except UnicodeDecodeError: