Skip to content

invalid-sentinel - why does the argument have to be a literal? #4142

Description

@DetachHead

https://pyrefly.org/en/docs/error-kinds/#invalid-sentinel

# First argument passed to sentinel constructor isn't a string literal
my_str: str = "MISSING"
A = Sentinel(my_str)

this requirement doesn't seem to be mentioned in the docs or the PEP, but interestingly pyright also reports the same error. (ty doesn't)

i'm wondering if theres some documentation somewhere i'm missing, or if this just came from an early draft of the PEP that was later removed?

Metadata

Metadata

Assignees

Labels

needs-discussionAn issue where it's not clear whether there is a bug or we are behaving as expected.typechecking

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions