Skip to content

Walk positional-only, keyword-only and annotated parameters in patchedast - #907

Open
marlon-costa-dc wants to merge 3 commits into
python-rope:masterfrom
marlon-costa-dc:pr/signature-tokens
Open

marlon-costa-dc wants to merge 3 commits into
python-rope:masterfrom
marlon-costa-dc:pr/signature-tokens

Conversation

@marlon-costa-dc

Copy link
Copy Markdown
Contributor

_arguments walked only node.args, so any signature using /, keyword-only parameters, or parameter annotations mis-regions in patchedast: the / marker, the parameters after *, annotated *args/**kwargs, and : annotation tokens were not part of the children.

This walks posonlyargs emitting / after them, kwonlyargs after *, keeps vararg/kwarg as walked nodes when annotated, and emits : annotation for every annotated parameter.

Also included: two small ride-alongs — removing the pre-3.8 _AsyncStatementFinder dead code in extract.py (requires-python is 3.10) and replacing deprecated datetime.utcnow in autoimport sqlite.

patchedasttest: 172 passed locally on 3.13.

Marlon Costa 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.
Copilot AI balanced review requested due to automatic review settings October 18, 2026 14:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.39%. Comparing base (22f5e50) to head (d0d466a).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants