Repository navigation
Walk positional-only, keyword-only and annotated parameters in patchedast - #907
Open
marlon-costa-dc wants to merge 3 commits into
Open
marlon-costa-dc wants to merge 3 commits into
marlon-costa-dc wants to merge 3 commits into
Conversation
added 3 commits
October 18, 2026 10:41
…dast _arguments walked only args, vararg and kwarg, and _arg consumed only the parameter name. Positional-only separators, bare '*', keyword-only parameters and annotations were skipped by the forward token search, so `def f(a, /, b, *, c)` produced a single child and annotations were swallowed as whitespace; a second annotation containing a call could raise MismatchedTokenError. _arguments now emits every signature token in source order and _arg walks its annotation. Unannotated *args/**kwargs keep their name-string children, so existing region expectations are unchanged.
The requires-python floor is 3.10, so ast.PyCF_ALLOW_TOP_LEVEL_AWAIT always exists and _AsyncStatementFinder can never run.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #907 +/- ##
==========================================
+ Coverage 95.34% 95.39% +0.04%
==========================================
Files 134 134
Lines 26762 26786 +24
==========================================
+ Hits 25516 25552 +36
+ Misses 1246 1234 -12 ☔ View full report in Codecov by Harness. 🚀 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.
_argumentswalked onlynode.args, so any signature using/, keyword-only parameters, or parameter annotations mis-regions in patchedast: the/marker, the parameters after*, annotated*args/**kwargs, and: annotationtokens were not part of the children.This walks
posonlyargsemitting/after them,kwonlyargsafter*, keeps vararg/kwarg as walked nodes when annotated, and emits: annotationfor every annotated parameter.Also included: two small ride-alongs — removing the pre-3.8
_AsyncStatementFinderdead code in extract.py (requires-python is 3.10) and replacing deprecateddatetime.utcnowin autoimport sqlite.patchedasttest: 172 passed locally on 3.13.