Repository navigation
Conversation
PurePath.full_match() is a pure path method like match(), but trio.Path wrapped it to run in a worker thread, so path.full_match(pattern) returned a coroutine (always truthy) instead of a bool. Drop the wrapper so the inherited PurePath implementation is used.
ybai08
force-pushed
the
fix-path-full-match
branch
from
October 17, 2026 17:28
70c69be to
5bdd013
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3547 +/- ##
===============================================
Coverage 100.00000% 100.00000%
===============================================
Files 128 128
Lines 19474 19480 +6
Branches 1323 1323
===============================================
+ Hits 19474 19480 +6
🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
pathlib.PurePath.full_match()(added in Python 3.13) only works on the path string, the same waymatch()does. Buttrio.Pathwraps it with_wrap_method(pathlib.Path.full_match), so on 3.13+ it runs in a worker thread and gives back a coroutine:So
if path.full_match(pattern):is always true, and Python warns that the coroutine was never awaited.trio.Path.match()and the other pure methods are inherited fromPurePathand stay synchronous. The wrapper came in with the 3.13 bring-up in #3005. Runningmypy --python-version 3.14onsrc/trio/_path.pyalso reports it: the override'sAwaitable[bool]doesn't matchPurePath.full_matchreturningbool. CI runs mypy at 3.10, so CI doesn't hit that check.This removes the wrapper, so
trio.Pathuses the inheritedPurePath.full_match. If any code doesawait path.full_match(...), it will now fail withTypeError: object bool can't be used in 'await' expression. The newsfragment is filed asbugfix. I'm happy to change it tobreakingif you'd rather.Test:
test_full_match_is_syncinsrc/trio/_tests/test_path.py. It is skipped below 3.13.What was run locally (macOS arm64)
pytest src/trio/_tests/test_path.py. Before the fix,test_full_match_is_syncfails withassert <coroutine object PurePath.full_match at ...> is True. After the fix: 40 passed, 1 skipped.test_path.py40 passed, 1 skipped. Python 3.12.14: 39 passed, 2 skipped (the new test is skipped).pytest src/trioon 3.14: 823 passed, 73 skipped, 3 xfailed (main: 822 passed, 73 skipped, 3 xfailed).mypy --platform linux --python-version 3.14 src/trio/_path.py src/trio/_tests/test_path.py: clean. On main the same command reports thefull_matchoverride error.mypy --platform {linux,darwin,win32} src/trio(config python_version 3.10, run from a 3.14 venv): 28 errors in 5 unrelated files, the same set as on main. None are in the changed files.pytest --run-slow src/trio/_tests/test_exports.py: 8 failures, the same 8 as on main (pyright--verifytypesand jedi__notes__, both from the local environment). The mypy class-member checks pass.black --checkandruff checkon the changed files: clean.tox -e typing/type_completenessenvs, Windows, Linux, PyPy.