Skip to content

Conversation

@barneygale
Copy link
Contributor

@barneygale barneygale commented Jul 6, 2024

os.DirEntry.is_dir() already returns false when a file disappears, so the is_symlink() call is redundant. This brings fwalk()'s exception handling more in line with walk().

Handle "disappearing" files as in `walk()`: add them to the `nondirs` list
rather than omitting them entirely.
@barneygale barneygale added the performance Performance or resource usage label Jul 6, 2024
@barneygale barneygale changed the title GH-119169: Slightly speed up os.fwalk() GH-119169: Slightly os.fwalk() exception handling Jul 6, 2024
@barneygale barneygale changed the title GH-119169: Slightly os.fwalk() exception handling GH-119169: Simplify os.fwalk() exception handling Jul 6, 2024
@serhiy-storchaka
Copy link
Member

What if is_dir() fails for other reason? For example, what will happen if the filesystem is unmounted or removable storage is removed or connection fails for NFS? I have doubt that stat() will simply return ENOENT in these cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review performance Performance or resource usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants