Skip to content

Conversation

@barneygale
Copy link
Contributor

@barneygalebarneygale 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.
@barneygalebarneygale added the performance Performance or resource usage label Jul 6, 2024
@barneygalebarneygale changed the title GH-119169: Slightly speed up os.fwalk()GH-119169: Slightly os.fwalk() exception handlingJul 6, 2024
@barneygalebarneygale changed the title GH-119169: Slightly os.fwalk() exception handlingGH-119169: Simplify os.fwalk() exception handlingJul 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core reviewperformancePerformance or resource usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@barneygale@serhiy-storchaka