diff --git a/src/watchdog/utils/dirsnapshot.py b/src/watchdog/utils/dirsnapshot.py index 8b499694..5a4e1e8e 100644 --- a/src/watchdog/utils/dirsnapshot.py +++ b/src/watchdog/utils/dirsnapshot.py @@ -255,8 +255,7 @@ def __init__(self, path, recursive=True, def walk(self, root): try: - paths = [os.path.join(root, entry if isinstance(entry, str) else entry.name) - for entry in self.listdir(root)] + paths = [os.path.join(root, entry.name) for entry in self.listdir(root)] except OSError as e: # Directory may have been deleted between finding it in the directory # list of its parent and trying to delete its contents. If this diff --git a/tests/test_snapshot_diff.py b/tests/test_snapshot_diff.py index 850f3aed..45303d19 100644 --- a/tests/test_snapshot_diff.py +++ b/tests/test_snapshot_diff.py @@ -130,7 +130,7 @@ def listdir_fcn(path): if path == p("root", "dir"): rm(path, recursive=True) touch(path) - return os.listdir(path) + return os.scandir(path) mkdir(p('root')) mkdir(p('root', 'dir'))