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 | d21192df580d1ef33a04e89af2683af052e98ad3 (patch) | |
tree | 1892f0058617b7231b0159b0a711a0f4ba075282 | |
parent | c73ceed5ec40cbb6b0ec9192dab6f166ccc3f6bd (diff) | |
download | python-setuptools-bitbucket-d21192df580d1ef33a04e89af2683af052e98ad3.tar.gz |
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: |