Skip to content

Comparing two Sentinels with == raises reportOperatorIssue #10773

@Daraan

Description

@Daraan

Describe the bug

👋
Sentinels should rather be compared with is but afaik == is fine as well. Currently pyright raises an issue in case a Sentinel (or a union containing one) is compared with another sentinel.

Code or Screenshots
Code sample in pyright playground

# pyright: enableExperimentalFeatures=true
from typing_extensions import Sentinel

S = Sentinel("S")
S2 = Sentinel("S2")

S == S  #reportOperatorIssue
S == S2  #reportOperatorIssue

VS Code extension or command-line
playground 1.1.403

Metadata

Metadata

Assignees

No one assigned

    Labels

    addressed in next versionIssue is fixed and will appear in next published versionbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions