Made PEP 747 (Annotating Type Forms) no longer experimental#11302
Open
Viicos wants to merge 1 commit intomicrosoft:mainfrom
Open
Made PEP 747 (Annotating Type Forms) no longer experimental#11302Viicos wants to merge 1 commit intomicrosoft:mainfrom
Viicos wants to merge 1 commit intomicrosoft:mainfrom
Conversation
rchiodo
approved these changes
Mar 2, 2026
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: bidict (https://github.com/jab/bidict)
+ .../projects/bidict/bidict/_typing.py:31:28 - error: Variable not allowed in type expression (reportInvalidTypeForm)
+ .../projects/bidict/bidict/_typing.py:31:28 - error: Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value (reportInvalidTypeForm)
- 12 errors, 2 warnings, 0 informations
+ 14 errors, 2 warnings, 0 informations
ibis (https://github.com/ibis-project/ibis)
+ .../projects/ibis/ibis/expr/datatypes/core.py:1062:23 - error: No parameter named "geotype" (reportCallIssue)
+ .../projects/ibis/ibis/expr/datatypes/core.py:1063:24 - error: No parameter named "geotype" (reportCallIssue)
- 7557 errors, 262 warnings, 0 informations
+ 7559 errors, 262 warnings, 0 informations
sympy (https://github.com/sympy/sympy)
+ .../projects/sympy/sympy/core/add.py:93:7 - error: Base classes for class "Add" define method "sort_key" in incompatible way
+ Return type mismatch: base method returns type "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]", override returns type "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]"
+ "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]" is not assignable to "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]"
+ Tuple entry 4 is incorrect type
+ "Number" is not assignable to "One" (reportIncompatibleMethodOverride)
- .../projects/sympy/sympy/core/cache.py:135:8 - error: "lower" is not a known attribute of "None" (reportOptionalMemberAccess)
- .../projects/sympy/sympy/core/cache.py:139:32 - error: Argument of type "str | Unknown | None" cannot be assigned to parameter "x" of type "ConvertibleToInt" in function "__new__"
- Type "str | Unknown | None" is not assignable to type "ConvertibleToInt"
- Type "None" is not assignable to type "ConvertibleToInt"
- "None" is not assignable to "str"
- "None" is incompatible with protocol "Buffer"
- "__buffer__" is not present
- "None" is incompatible with protocol "SupportsInt"
- "__int__" is not present
- "None" is incompatible with protocol "SupportsIndex"
- ... (reportArgumentType)
- .../projects/sympy/sympy/core/cache.py:139:32 - error: Argument of type "str | Unknown | None" cannot be assigned to parameter "x" of type "ConvertibleToInt" in function "__new__"
- Type "str | Unknown | None" is not assignable to type "ConvertibleToInt"
- Type "None" is not assignable to type "ConvertibleToInt"
- "None" is not assignable to "str"
- "None" is incompatible with protocol "Buffer"
- "__buffer__" is not present
- "None" is incompatible with protocol "SupportsInt"
- "__int__" is not present
- "None" is incompatible with protocol "SupportsIndex" (reportArgumentType)
+ .../projects/sympy/sympy/core/expr.py:167:9 - error: Method "sort_key" overrides class "Basic" in an incompatible manner
+ Return type mismatch: base method returns type "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]", override returns type "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]"
+ "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]" is not assignable to "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]"
+ Tuple entry 4 is incorrect type
+ "Number" is not assignable to "One" (reportIncompatibleMethodOverride)
+ .../projects/sympy/sympy/core/mul.py:95:7 - error: Base classes for class "Mul" define method "sort_key" in incompatible way
+ Return type mismatch: base method returns type "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]", override returns type "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]"
+ "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]" is not assignable to "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]"
+ Tuple entry 4 is incorrect type
+ "Number" is not assignable to "One" (reportIncompatibleMethodOverride)
- .../projects/sympy/sympy/discrete/convolutions.py
- .../projects/sympy/sympy/discrete/convolutions.py:368:13 - error: No overloads for "__setitem__" match the provided arguments (reportCallIssue)
- .../projects/sympy/sympy/discrete/convolutions.py:368:13 - error: Argument of type "Any | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" cannot be assigned to parameter "value" of type "Zero" in function "__setitem__"
- Type "Any | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" is not assignable to type "Zero"
- "Expr" is not assignable to "Zero" (reportArgumentType)
- .../projects/sympy/sympy/discrete/convolutions.py:371:9 - error: No overloads for "__setitem__" match the provided arguments (reportCallIssue)
- .../projects/sympy/sympy/discrete/convolutions.py:371:9 - error: Argument of type "Any | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" cannot be assigned to parameter "value" of type "Zero" in function "__setitem__"
- Type "Any | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" is not assignable to type "Zero"
- "Expr" is not assignable to "Zero" (reportArgumentType)
+ .../projects/sympy/sympy/functions/elementary/miscellaneous.py:380:7 - error: Base classes for class "MinMaxBase" define method "sort_key" in incompatible way
+ Return type mismatch: base method returns type "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]", override returns type "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]"
+ "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]" is not assignable to "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]"
+ Tuple entry 4 is incorrect type
... (truncated 417 lines) ...
prefect (https://github.com/PrefectHQ/prefect)
- .../projects/prefect/src/integrations/prefect-dask/tests/test_task_runners.py:104:31 - error: Argument of type "PrefectFuture[str]" cannot be assigned to parameter "b" of type "str" in function "submit"
- "PrefectFuture[str]" is not assignable to "str" (reportArgumentType)
+ .../projects/prefect/src/integrations/prefect-dask/tests/test_task_runners.py:103:24 - error: Cannot access attribute "submit" for class "FunctionType"
+ Attribute "submit" is unknown (reportFunctionMemberAccess)
+ .../projects/prefect/src/integrations/prefect-dask/tests/test_task_runners.py:104:17 - error: Type of "task_c" could not be determined because it refers to itself (reportGeneralTypeIssues)
- "str" is incompatible with protocol "Awaitable[_T_co@Awaitable]"
- "__await__" is not present (reportGeneralTypeIssues)
- .../projects/prefect/src/integrations/prefect-dask/tests/test_task_runners.py:110:22 - error: "str" is not awaitable
+ .../projects/prefect/src/integrations/prefect-dask/tests/test_task_runners.py:177:24 - error: Cannot access attribute "submit" for class "FunctionType"
+ Attribute "submit" is unknown (reportFunctionMemberAccess)
+ .../projects/prefect/src/integrations/prefect-dask/tests/test_task_runners.py:178:17 - error: Type of "task_c" could not be determined because it refers to itself (reportGeneralTypeIssues)
+ .../projects/prefect/src/integrations/prefect-dask/tests/test_task_runners.py:181:25 - error: Type of "test_flow" could not be determined because it refers to itself (reportGeneralTypeIssues)
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:220:24 - error: Cannot access attribute "submit" for class "FunctionType"
+ Attribute "submit" is unknown (reportFunctionMemberAccess)
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:221:17 - error: Type of "task_c" could not be determined because it refers to itself (reportGeneralTypeIssues)
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:224:19 - error: Type of "test_flow" could not be determined because it refers to itself (reportGeneralTypeIssues)
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:248:17 - error: Type of "task_c" could not be determined because it refers to itself (reportGeneralTypeIssues)
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:252:17 - error: Type of "test_flow" could not be determined because it refers to itself (reportGeneralTypeIssues)
- .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:226:22 - error: "str" is not awaitable
- "str" is incompatible with protocol "Awaitable[_T_co@Awaitable]"
- "__await__" is not present (reportGeneralTypeIssues)
- .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:255:24 - error: "tuple[PrefectFuture[NoReturn], PrefectFuture[NoReturn], PrefectFuture[Unknown], PrefectFuture[Unknown]]" is not awaitable
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:255:24 - error: "tuple[PrefectFuture[NoReturn], PrefectFuture[NoReturn], PrefectFuture[Unknown], Unknown]" is not awaitable
- "tuple[PrefectFuture[NoReturn], PrefectFuture[NoReturn], PrefectFuture[Unknown], PrefectFuture[Unknown]]" is incompatible with protocol "Awaitable[_T_co@Awaitable]"
+ "tuple[PrefectFuture[NoReturn], PrefectFuture[NoReturn], PrefectFuture[Unknown], Unknown]" is incompatible with protocol "Awaitable[_T_co@Awaitable]"
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:294:24 - error: Cannot access attribute "submit" for class "FunctionType"
+ Attribute "submit" is unknown (reportFunctionMemberAccess)
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:295:17 - error: Type of "task_c" could not be determined because it refers to itself (reportGeneralTypeIssues)
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:298:25 - error: Type of "test_flow" could not be determined because it refers to itself (reportGeneralTypeIssues)
- 5978 errors, 179 warnings, 0 informations
+ 5988 errors, 179 warnings, 0 informations
pip (https://github.com/pypa/pip)
+ .../projects/pip/src/pip/_vendor/rich/table.py
+ .../projects/pip/src/pip/_vendor/rich/table.py:939:13 - error: No parameter named "caption_justify" (reportCallIssue)
- 1107 errors, 31 warnings, 0 informations
+ 1108 errors, 31 warnings, 0 informations
static-frame (https://github.com/static-frame/static-frame)
+ .../projects/static-frame/static_frame/core/util.py:1044:32 - error: Attribute type cannot use type variable "TVFGItem@__init__" scoped to local method (reportGeneralTypeIssues)
- 58 errors, 71 warnings, 0 informations
+ 59 errors, 71 warnings, 0 informations
rich (https://github.com/Textualize/rich)
+ .../projects/rich/rich/table.py
+ .../projects/rich/rich/table.py:948:13 - error: No parameter named "caption_justify" (reportCallIssue)
- 369 errors, 43 warnings, 0 informations
+ 370 errors, 43 warnings, 0 informations
|
Collaborator
|
@Viicos, it looks like the changes are causing a single test failure. |
Contributor
Author
|
Looks like a bug, that can be reproduce with the following MRE: from typing import NamedTuple
# X is necessary to reproduce. Doesn't reproduce with only "a" as a field
X = NamedTuple("X", [("a", int), ("b", str)])
X(1, "1")
class Z(NamedTuple):
c: list[str]
d: list[int]
q6 = Z(["1"], [3]) # Error: Class definition for "Z" depends on itself
# This is necessary to reproduce
for a, b in zip(*q6): # needs to be named a and b to reproduce
passLLM analysisThe The chain of events:
The reason both X and the zip call are needed:
The fix should restore the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
as it was recently accepted: https://discuss.python.org/t/55984/103.