Skip to content

Commit 7b72bfb

Browse files
authored
Using correct typing for param_hint (#2990)
2 parents eaf33a9 + b2f2643 commit 7b72bfb

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

CHANGES.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ Unreleased
88
- Fix reconciliation of `default`, `flag_value` and `type` parameters for
99
flag options, as well as parsing and normalization of environment variables.
1010
:issue:`2952` :pr:`2956`
11+
- Fix typing issue in ``BadParameter`` and ``MissingParameter`` exceptions for the
12+
parameter ``param_hint`` that did not allow for a sequence of string where the
13+
underlying functino ``_join_param_hints`` allows for it. :issue:`2777` :pr:`2990`
1114
- Use the value of ``Enum`` choices to render their default value in help
1215
screen. Refs :issue:`2911` :pr:`3004`
1316
- Fix completion for the Z shell (``zsh``) for completion items containing
1417
colons. :issue:`2703` :pr:`2846`
1518

16-
1719
Version 8.2.1
1820
-------------
1921

src/click/exceptions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def __init__(
115115
message: str,
116116
ctx: Context | None = None,
117117
param: Parameter | None = None,
118-
param_hint: str | None = None,
118+
param_hint: cabc.Sequence[str] | str | None = None,
119119
) -> None:
120120
super().__init__(message, ctx)
121121
self.param = param
@@ -151,15 +151,15 @@ def __init__(
151151
message: str | None = None,
152152
ctx: Context | None = None,
153153
param: Parameter | None = None,
154-
param_hint: str | None = None,
154+
param_hint: cabc.Sequence[str] | str | None = None,
155155
param_type: str | None = None,
156156
) -> None:
157157
super().__init__(message or "", ctx, param, param_hint)
158158
self.param_type = param_type
159159

160160
def format_message(self) -> str:
161161
if self.param_hint is not None:
162-
param_hint: str | None = self.param_hint
162+
param_hint: cabc.Sequence[str] | str | None = self.param_hint
163163
elif self.param is not None:
164164
param_hint = self.param.get_error_hint(self.ctx) # type: ignore
165165
else:

0 commit comments

Comments
 (0)