diff --git a/conformance/results/mypy/callables_kwargs.toml b/conformance/results/mypy/callables_kwargs.toml index 1b2578dd..39eaad11 100644 --- a/conformance/results/mypy/callables_kwargs.toml +++ b/conformance/results/mypy/callables_kwargs.toml @@ -1,4 +1,7 @@ -conformant = "Pass" +conformant = "Partial" +notes = """ +Allows callable without kwargs to be assigned to callable with unpacked kwargs +""" output = """ callables_kwargs.py:22: note: "func1" defined here callables_kwargs.py:46: error: Missing named argument "v1" for "func1" [call-arg] @@ -21,6 +24,7 @@ callables_kwargs.py:103: note: "TDProtocol5.__call__" has type "Callable[[Arg(in callables_kwargs.py:111: error: Overlap between argument names and ** TypedDict items: "v1" [misc] callables_kwargs.py:122: error: Unpack item in ** argument must be a TypedDict [misc] """ -conformance_automated = "Pass" +conformance_automated = "Fail" errors_diff = """ +Line 134: Expected 1 errors """ diff --git a/conformance/results/mypy/version.toml b/conformance/results/mypy/version.toml index 869e8bf2..167122da 100644 --- a/conformance/results/mypy/version.toml +++ b/conformance/results/mypy/version.toml @@ -1,2 +1,2 @@ version = "mypy 1.15.0" -test_duration = 2.0 +test_duration = 1.2 diff --git a/conformance/results/pyre/callables_kwargs.toml b/conformance/results/pyre/callables_kwargs.toml index 6714bfea..a325fe97 100644 --- a/conformance/results/pyre/callables_kwargs.toml +++ b/conformance/results/pyre/callables_kwargs.toml @@ -15,6 +15,7 @@ callables_kwargs.py:102:0 Incompatible variable type [9]: v4 is declared to have callables_kwargs.py:103:0 Incompatible variable type [9]: v5 is declared to have type `TDProtocol5` but is used as type `typing.Callable(func1)[[Keywords(Unpack[TD2])], None]`. callables_kwargs.py:111:21 Duplicate parameter [65]: Duplicate parameter name `v1`. callables_kwargs.py:122:12 Invalid type [31]: `Unpack` in kwargs may only be used with typed dictionaries. `Variable[T (bound to TD2)]` is not a typed dictionary. +callables_kwargs.py:134:0 Incompatible variable type [9]: v7 is declared to have type `TDProtocol6` but is used as type `typing.Callable(func7)[[KeywordOnly(v1, int), KeywordOnly(v3, str), KeywordOnly(v2, str, default)], None]`. """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/pyre/version.toml b/conformance/results/pyre/version.toml index 028806c2..a23f5b07 100644 --- a/conformance/results/pyre/version.toml +++ b/conformance/results/pyre/version.toml @@ -1,2 +1,2 @@ version = "pyre 0.9.23" -test_duration = 6.5 +test_duration = 7.8 diff --git a/conformance/results/pyright/callables_kwargs.toml b/conformance/results/pyright/callables_kwargs.toml index 9dea95b6..c0c09387 100644 --- a/conformance/results/pyright/callables_kwargs.toml +++ b/conformance/results/pyright/callables_kwargs.toml @@ -1,4 +1,7 @@ -conformant = "Pass" +conformant = "Partial" +notes = """ +Allows callable without kwargs to be assigned to callable with unpacked kwargs +""" output = """ callables_kwargs.py:28:5 - error: Could not access item in TypedDict   "v2" is not a required key in "TD2", so access may result in runtime exception (reportTypedDictNotRequiredAccess) @@ -28,6 +31,7 @@ callables_kwargs.py:103:19 - error: Type "(**kwargs: **TD2) -> None" is not assi callables_kwargs.py:111:30 - error: Typed dictionary overlaps with keyword parameter: v1 (reportGeneralTypeIssues) callables_kwargs.py:122:21 - error: Expected TypedDict type argument for Unpack (reportGeneralTypeIssues) """ -conformance_automated = "Pass" +conformance_automated = "Fail" errors_diff = """ +Line 134: Expected 1 errors """ diff --git a/conformance/results/pyright/version.toml b/conformance/results/pyright/version.toml index 48280a0c..20ccca9b 100644 --- a/conformance/results/pyright/version.toml +++ b/conformance/results/pyright/version.toml @@ -1,2 +1,2 @@ version = "pyright 1.1.393" -test_duration = 1.2 +test_duration = 1.4 diff --git a/conformance/results/pytype/callables_kwargs.toml b/conformance/results/pytype/callables_kwargs.toml index a44b3c5c..9e727dae 100644 --- a/conformance/results/pytype/callables_kwargs.toml +++ b/conformance/results/pytype/callables_kwargs.toml @@ -82,6 +82,7 @@ Line 102: Expected 1 errors Line 103: Expected 1 errors Line 111: Expected 1 errors Line 122: Expected 1 errors +Line 134: Expected 1 errors Line 10: Unexpected errors ['callables_kwargs.py:10:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : typing.Unpack not supported yet [not-supported-yet]'] Line 24: Unexpected errors ['callables_kwargs.py:24:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func1: Unpack[TD2] [assert-type]'] Line 32: Unexpected errors ['callables_kwargs.py:32:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func1: Unpack[TD2] [assert-type]'] diff --git a/conformance/results/results.html b/conformance/results/results.html index c2819a3e..7be25aaa 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -159,13 +159,13 @@

Python Type System Conformance Test Results

- - + + diff --git a/conformance/tests/callables_kwargs.py b/conformance/tests/callables_kwargs.py index d8138efe..c52319fc 100644 --- a/conformance/tests/callables_kwargs.py +++ b/conformance/tests/callables_kwargs.py @@ -121,3 +121,14 @@ def func5(v1: int, **kwargs: Unpack[TD2]) -> None: # E: parameter v1 overlaps w def func6(**kwargs: Unpack[T]) -> None: # E: unpacked value must be a TypedDict, not a TypeVar bound to TypedDict. ... + +# > The situation where the destination callable contains **kwargs: Unpack[TypedDict] and +# > the source callable doesn’t contain **kwargs should be disallowed. This is because, +# > we cannot be sure that additional keyword arguments are not being passed in when an instance of a subclass +# > had been assigned to a variable with a base class type and then unpacked in the destination callable invocation + +def func7(*, v1: int, v3: str, v2: str = "") -> None: + ... + + +v7: TDProtocol6 = func7 # E: source does not have kwargs
 
mypy 1.15.0
-
2.0sec
+
1.2sec
pyright 1.1.393
-
1.2sec
+
1.4sec
pyre 0.9.23
-
6.5sec
+
7.8sec
pytype 2024.10.11
36.6sec
@@ -607,8 +607,8 @@

Python Type System Conformance Test Results

Partial

Does not support Concatenate.

Does not treat "*args: Any, **kwargs: Any" as "...".

     callables_kwargsPassPass
Partial

Allows callable without kwargs to be assigned to callable with unpacked kwargs

Partial

Allows callable without kwargs to be assigned to callable with unpacked kwargs

Pass
Unsupported

Does not understand Unpack in the context of **kwargs annotation.