From ec942ef2f38c5821c3e66c5662dfcb5461238a47 Mon Sep 17 00:00:00 2001 From: pramod5403 Date: Mon, 10 Nov 2025 21:46:07 +0530 Subject: [PATCH] Fix _validate_key to handle click 8.3.1 Sentinel values Fixes #5836 Updates the condition in _validate_key to properly check for click._utils.UNSET sentinel value, which is now present in ctx.params during callbacks in click 8.3.1. --- src/flask/cli.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/flask/cli.py b/src/flask/cli.py index 3fa65cfd..2c59c77c 100644 --- a/src/flask/cli.py +++ b/src/flask/cli.py @@ -858,8 +858,7 @@ def _validate_key(ctx: click.Context, param: click.Parameter, value: t.Any) -> t ctx.params["cert"] = cert, value else: - if cert and not (is_adhoc or is_context): - raise click.BadParameter('Required when using "--cert".', ctx, param) + if cert is not None and cert != click._utils.UNSET and not (is_adhoc or is_context): raise click.BadParameter('Required when using "--cert".', ctx, param) return value