You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sentinel values are not assignable to Sentinel #5696
I use a typing_extensions.Sentinel value as the MISSING default for optional fields, and annotate those fields with a generic alias like T | Sentinel, so one alias works for any sentinel.
Pyrefly rejects the MISSING default on every such field.
fromtyping_extensionsimportSentinelMISSING=Sentinel("MISSING")
value: Sentinel=MISSING# error: `MISSING` is not assignable to `sentinel`deff(value: int|Sentinel=MISSING) ->None: ...
# error: Default `MISSING` is not assignable to parameter `value` with type `int | sentinel`
I expected both lines to be accepted:
isinstance(MISSING, Sentinel) is True at runtime
the type MISSING contains only that one sentinel object.
Different sentinels should stay incompatible, though: assigning OTHER to a variable annotated MISSING should still be an error.
Activity
synnks commentedon Nov 19, 2026
#claim
github-actions commentedon Nov 19, 2026
@synnks you've claimed this issue — it's now assigned to you. Thanks for picking it up! 🎉