Skip to content

GH-119169: Simplify os.fwalk() exception handling #121432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

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