Skip to content

Incorrect error message for valid match/case {**rest,} syntax #1436

@nedbat

Description

@nedbat

This code generates an error:

match x:
    case {"a": 1, **keys,}:
        print("hello")

produces: CSTValidationError("Cannot have a trailing comma without **rest")

The error shouldn't happen, since this is valid syntax.

BTW: the error message is also inverted, it's trying to say "Cannot have a trailing comma with **rest"

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