Skip to content

Commit 4b14faf

Browse files
fix(typing): Using correct typing for param_hint
The typing of `param_hint` between `BadParameter`, `MissingParameter` and `_join_param_hints` was different. The firsts only allowed for a `str` where the later also accept a sequence of `str`. Fixes #2777
1 parent 565f36d commit 4b14faf

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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)