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
310310 if not func .arg_types :
311311 # Invalid method, return something.
312312 return cast (F , func )
313- if func .arg_kinds [0 ] == ARG_STAR :
313+ if func .arg_kinds [0 ] in ( ARG_STAR , ARG_STAR2 ) :
314314 # The signature is of the form 'def foo(*args, ...)'.
315315 # In this case we shouldn't drop the first arg,
316316 # since func will be absorbed by the *args.
317-
318317 # 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.
319321 return cast (F , func )
320322 self_param_type = get_proper_type (func .arg_types [0 ])
321323
Original file line number Diff line number Diff line change @@ -3579,6 +3579,24 @@ class Test:
35793579 run(test2, other=0, **params) # E: Argument "other" to "run" has incompatible type "int"; expected "str"
35803580[builtins fixtures/tuple.pyi]
35813581
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+
35823600[case testTypedDictInlineNoOldStyleAlias]
35833601# flags: --enable-incomplete-feature=InlineTypedDict
35843602X = {"int": int, "str": str}
You can’t perform that action at this time.
0 commit comments