Skip to content

False positive? Syntax Error for a valid Python expression  #600

Closed as not planned
@qexat

Description

@qexat

Hi. First of all, thank you for building ptpython, it is amazing. It has been my go-to Python REPL coupled with my custom .pythonrc for a while now.

Now to the report:

>>> from __future__ import annotations
>>> x: (y := 5) = 3
[Syntax Error: named expression cannot be used within an annotation (<input>, line 1)]

The error does not show when the annotations feature is not present.

In my opinion, either the syntax error should not happen, or it should always occur, even when __future__.annotations is not enabled.

I searched the issue tracker with "named expression", "within an annotation" which did not yield any results.

Python: 3.12.7
ptpython: 3.0.29

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions