diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2016-01-23 18:49:52 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-01-23 18:49:52 -0500 |
commit | 9363ee420bd803f333b31466796ff00a183de66e (patch) | |
tree | 6236038825612f03f51fa96d98a1389b3717f3c5 | |
parent | 25a12d49012ef636eb5cc929163f89188b084c3f (diff) | |
download | external_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.py | 6 |
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: |