Repository navigation
lookup_default returns Sentinel.UNSET instead of None #3145
Description
Activity
@kdeldycke it's time to just make a new API. The problem will be that people are overriding the old API still, so how do we account for that. Maybe we just make UNSET public after all. It's too hard to account for people overriding unexpected "documented" APIs.
😭
I guess I'll have to fix it in the same spirit as of the last #3137. Let's see where my investigations leads me.
@kdeldycke it's time to just make a new API. The problem will be that people are overriding the old API still, so how do we account for that. Maybe we just make UNSET public after all. It's too hard to account for people overriding unexpected "documented" APIs.
As for the next few weeks/months, we can still play whack-a-mole to stabilize everything in 8.x.y releases. Then just bump Click to 9.0.0, to change the expectations (private/public stuff) and the data contract (
UNSET, native Python types/strings, etc). I think it's time to start planning for 9.0.0 with more granular tasks.Reacted by David Lord and Stephen Rosen- changed the title
[-]lookup_default returns Sentinel.UNSET instead of None[/-][+]`lookup_default` returns `Sentinel.UNSET` instead of `None`[/+]on Nov 18, 2025 - added a commit that references this issue
on Jan 31, 2026 - added a commit that references this issue
on Feb 17, 2026 - added a commit that references this issue
on Feb 17, 2026 - added 2 commits that reference this issue
on Feb 20, 2026 - linked a pull request that will close this issueHide `Sentinel.UNSET` values as `None` in `lookup_default()` #3224
on Feb 20, 2026 - added a commit that references this issue
on Feb 20, 2026 I have a fix available for review/merge at: #3224
A fix has been merged upstream in
stablebranch. It will be part of the soon-to-be-released v8.3.2 of Click.- locked as resolved and limited conversation to collaborators
on Mar 15, 2026 - addedparsingParsing, parameters, commands, chaining, contextParsing, parameters, commands, chaining, contextand removed
on Aug 8, 2026
Upgrading click to 8.3.0 or 8.3.1 causes a regression in lookup_default
Reproduce
Change the click dependency in the below reproduce case to 8.2.1 and the assertion does not fail.
Install uv. Run with
uv run repro_click_unset_regression.pyor simply `repro_click_unset_regression.py'.Expected
Return None instead of internal Sentinel.UNSET detail.
Environment: