py3: os.walk explicitly returns bytes when given a bytes argument

And therefore when replacing paths in it, we need to use bytes as well.
This commit is contained in:
Eli Schwartz 2019-05-19 14:22:35 -04:00
parent 00ed9305cb
commit 047d539e0a
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6

View File

@ -605,7 +605,7 @@ class DirContainer(object):
for root, dirs, files in os.walk(base):
for fname in files:
fname = os.path.join(root, fname)
fname = fname.replace('\\', '/')
fname = fname.replace(b'\\', b'/')
if not isinstance(fname, unicode_type):
try:
fname = fname.decode(filesystem_encoding)