From 193a049b9641451a71e24abf16951796ed3f843d Mon Sep 17 00:00:00 2001 From: jiyujie2006 <49909156+jiyujie2006@users.noreply.github.com> Date: Sun, 31 May 2026 15:08:57 +0800 Subject: [PATCH] Preserve CLI cert type checking --- src/flask/cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/flask/cli.py b/src/flask/cli.py index 26629d5c..fcf4e7ef 100644 --- a/src/flask/cli.py +++ b/src/flask/cli.py @@ -33,6 +33,10 @@ if t.TYPE_CHECKING: from .app import Flask + _CertParamTypeBase = click.ParamType[str | os.PathLike[str] | ssl.SSLContext] +else: + _CertParamTypeBase = click.ParamType + class NoAppException(click.UsageError): """Raised if an application cannot be found or loaded.""" @@ -777,7 +781,7 @@ def show_server_banner(debug: bool, app_import_path: str | None) -> None: click.echo(f" * Debug mode: {'on' if debug else 'off'}") -class CertParamType(click.ParamType): +class CertParamType(_CertParamTypeBase): """Click option type for the ``--cert`` option. Allows either an existing file, the string ``'adhoc'``, or an import for a :class:`~ssl.SSLContext` object.