Avoid using the list comprehension loop variable

It works fine but it relies on leaky scopes.
This commit is contained in:
Jean-Paul Calderone 2018-04-26 15:16:00 -04:00
parent 9f8c90393f
commit 6b16afaa2e

View File

@ -335,8 +335,8 @@ def listdir_unicode_fallback(path):
try: try:
return [unicode(fn, filesystem_encoding) for fn in os.listdir(byte_path)] return [unicode(fn, filesystem_encoding) for fn in os.listdir(byte_path)]
except UnicodeDecodeError: except UnicodeDecodeError as e:
raise FilenameEncodingError(fn) raise FilenameEncodingError(e.object)
def listdir_unicode(path): def listdir_unicode(path):
""" """