From 9363ee420bd803f333b31466796ff00a183de66e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 23 Jan 2016 18:49:52 -0500 Subject: Extract variable for candidate encodings --- setuptools/unicode_utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'setuptools/unicode_utils.py') 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: -- cgit v1.2.1