Fix lookup_default returning UNSET sentinel instead of None by veeceey · Pull Request #3202 · pallets/click

and others added 2 commits

February 8, 2026 15:01
Fixes pallets#3145. Since 8.3.0 Context.lookup_default leaked the internal
UNSET sentinel to callers instead of returning None when no default
was found. This broke subclasses and external code that relied on the
documented return type (Any | None).

Extract a private _lookup_default method that returns UNSET for
internal callers that need to distinguish "not set" from None, and
have the public lookup_default convert UNSET to None before returning.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>