Skip to content

Recognize walrus targets in call arguments - #249

Open
AryanRG wants to merge 1 commit into
davidhalter:masterfrom
AryanRG:fix/walrus-argument-definitions
Open

AryanRG wants to merge 1 commit into
davidhalter:masterfrom
AryanRG:fix/walrus-argument-definitions

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 17, 2026

Copy link
Copy Markdown

Summary

Recognize the target of an unparenthesized assignment expression in a call argument as a definition. Previously, parso.parse('f(target := source)').get_used_names()['target'][0].get_definition() returned None, while the parenthesized form worked.

The change only classifies the left-hand target of a direct argument node; right-hand references and ordinary keyword arguments retain their existing behavior. It also allows existing syntax checks that depend on definition classification to match Python's treatment of these assignments.

Validation

  • New regression and control cases cover seven grammar versions (3.8–3.14): 56 cases fail on the base, and all 105 focused cases pass with this patch.
  • Full local suite: 2,094 passed on Python 3.12.15.
  • Flake8, Zuban, and whitespace checks passed. Other interpreter runtimes, external consumers, and hosted CI remain unverified.

Prepared with AI assistance; regression tests and the full suite were run locally.

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.

1 participant