Skip to content

A SyntaxError less detailed since 3.10 in specific example #94192

@Serpens66

Description

@Serpens66

Python 3.10.5

New SyntaxError ^ pointer is misleading in following example compared to older python versions.

d = { "foo":"foo", "bar":lambda b:{"bar":testfn(von="1"b=b)}, } 

Results in error message on 3.10.5:

File "test.py", line 3 "bar":lambda b:{"bar":testfn(von="1"b=b)}, ^ SyntaxError: expression expected after dictionary key and ':' 

While on python 3.8 it was more helpful:

File "test.py", line 3 "bar":lambda b:{"bar":testfn(von="1"b=b)}, ^ SyntaxError: invalid syntax 

edit: added triple backquotes to preserve formatting on github. thanks hauntsaninja.
On 3.10.5 it is pointing on the ":" prior to lambda, while on 3.8 it is pointing on the missing comma.

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions