File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -310,12 +310,14 @@ class B(A): pass
310
310
if not func .arg_types :
311
311
# Invalid method, return something.
312
312
return cast (F , func )
313
- if func .arg_kinds [0 ] == ARG_STAR :
313
+ if func .arg_kinds [0 ] in ( ARG_STAR , ARG_STAR2 ) :
314
314
# The signature is of the form 'def foo(*args, ...)'.
315
315
# In this case we shouldn't drop the first arg,
316
316
# since func will be absorbed by the *args.
317
-
318
317
# TODO: infer bounds on the type of *args?
318
+
319
+ # In the case of **kwargs we should probably emit an error, but
320
+ # for now we simply skip it, to avoid crashes down the line.
319
321
return cast (F , func )
320
322
self_param_type = get_proper_type (func .arg_types [0 ])
321
323
Original file line number Diff line number Diff line change @@ -3579,6 +3579,24 @@ class Test:
3579
3579
run(test2, other=0, **params) # E: Argument "other" to "run" has incompatible type "int"; expected "str"
3580
3580
[builtins fixtures/tuple.pyi]
3581
3581
3582
+ [case testTypedDictUnpackSingleWithSubtypingNoCrash]
3583
+ from typing import Callable
3584
+ from typing_extensions import TypedDict, Unpack
3585
+
3586
+ class Kwargs(TypedDict):
3587
+ name: str
3588
+
3589
+ def f(**kwargs: Unpack[Kwargs]) -> None:
3590
+ pass
3591
+
3592
+ class C:
3593
+ d: Callable[[Unpack[Kwargs]], None]
3594
+
3595
+ # TODO: it is an old question whether we should allow this, for now simply don't crash.
3596
+ class D(C):
3597
+ d = f
3598
+ [builtins fixtures/tuple.pyi]
3599
+
3582
3600
[case testTypedDictInlineNoOldStyleAlias]
3583
3601
# flags: --enable-incomplete-feature=InlineTypedDict
3584
3602
X = {"int": int, "str": str}
You can’t perform that action at this time.
0 commit comments