Decode bytes path to str for os.path.ismount

Fixes #2221 on Windows
This commit is contained in:
Heath Stewart 2022-11-30 15:05:17 -08:00
parent 50d73bfbc8
commit 6989acee63
No known key found for this signature in database
1 changed files with 3 additions and 1 deletions

View File

@ -16,7 +16,9 @@ def generate_directories(path):
if os.path.isdir(path):
yield path
while True:
if os.path.ismount(path):
# Work around https://github.com/python/cpython/issues/96192
_path = os.fsdecode(path) if isinstance(path, bytes) else path
if os.path.ismount(_path):
break
old_path = path
path = os.path.dirname(path)