Skip to content

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

Open
barneygale wants to merge 3 commits into
python:mainfrom
barneygale:os-fwalk-speedup
Open

GH-119169: Simplify os.fwalk() exception handling#121432
barneygale wants to merge 3 commits into
python:mainfrom
barneygale:os-fwalk-speedup

Conversation

@barneygale

@barneygalebarneygale commented Jul 6, 2024

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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.

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actionsgithub-actionsBot added the stale Stale PR or inactive for long period of time. label Apr 17, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core reviewperformancePerformance or resource usagestaleStale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@barneygale@serhiy-storchaka