Skip to content

Commit d1837c4

Browse files
committed
Resolve issue with starred index expression in Python < 3.11
1 parent 3102ddf commit d1837c4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ninja/signature/details.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,11 @@ def _get_param_type(self, name: str, arg: inspect.Parameter) -> FuncParam:
227227
if len(args) == 2:
228228
annotation, default = args
229229
else:
230-
annotation, default = Annotated[*args[:-1]], args[-1]
230+
# NOTE: Annotated[args[:-1]] seems to have the same runtime
231+
# behavior as Annotated[*args[:-1]], but the latter is
232+
# invalid in Python < 3.11 because star expressions
233+
# were not allowed in index expressions.
234+
annotation, default = Annotated[args[:-1]], args[-1]
231235
if prev_default != self.signature.empty:
232236
default.default = prev_default
233237

0 commit comments

Comments
 (0)