python / python/cpython

Misleading error for ((a) := 1)

Open
#138,294 2 comments 0 reactions 0 assignees View on GitHub

@dbXD320 is already working on this.

Since Sep 7, 2025.

interpreter-core topic-parser type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

>>> ((a) := 1)
  File "<python-input-0>", line 1
    ((a) := 1)
      ^
SyntaxError: cannot use assignment expressions with name

Of course, it can. You only need to remove parentheses around the name.

>>> (a := 1)
1
Linked PRs
  • gh-138627

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the two Python console examples from the issue and compare the misleading SyntaxError with the valid unparenthesized form. Review linked PR gh-138627 first; done means the parenthesized assignment expression reports the correct error or is accepted consistently with the demonstrated valid form.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.