Repository navigation
Fix WcMatch returning a file after a directory hook aborts - #252
Merged
facelessuser merged 1 commit intoOct 23, 2026
Merged
Conversation
A directory validation hook can call kill directly or through its error handler. Stop before searching files when either hook aborts the walk.
Owner
|
I'm not sure I'd call this a bug, per se. Aborts aren't guaranteed to stop immediately; it's more whenever it's done with what it is doing and gets to the next abort checkpoint, but an extra check before iterating files probably isn't bad. |
Owner
|
@gir-bot lgtm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
root/a.txt,root/b.txt, androot/sub/c.txt,WcMatch('root', '*.txt', flags=RECURSIVE).match()returns:on_validate_directorycallskill()and returnsTrue:['root/b.txt'].on_validate_directoryraisesOSError;on_errorcallskill():['root/b.txt'].Both should return
[], matchingkill's documented "gracefully kill the internal searching" behavior._walkbreaks only the directory loop, then searches files before checking the abort flag.The abort flag is now checked before entering the file loop. Walks without
kill()and calls tokill()while iteratingimatch()keep their results (test_abort).Both new tests fail without the fix and pass with it.