Skip to content

Incorrect SyntaxError for * in strings in annotations (e.g. Annotated, Literal) #16874

@rg936672

Description

@rg936672

Summary

Summary: * in strings that are part of annotations (e.g. in Annotated, Literal, or jaxtyping.Shaped annotations) is erroneously marked as a SyntaxError.

Playground link.

These should be allowed; the code runs perfectly fine under Python 3.9 and 3.10.

This issue is new in ruff 0.11.1 with preview enabled; it doesn't appear in ruff 0.11.0 or with preview disabled.

Version

ruff 0.11.1 (c1971fd 2025-03-20)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpreviewRelated to preview mode features

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions