From 0d9d81894597b4894d23f54826814c4c8b5a1ddf Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 17 Sep 2026 14:18:34 +0200 Subject: [PATCH 1/3] Update pyright to 1.1.413 Closes: #16408 --- requirements-tests.txt | 2 +- stdlib/@tests/test_cases/check_types.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements-tests.txt b/requirements-tests.txt index c452aa0a1871..217dd276b46e 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -2,7 +2,7 @@ # be pinned to a specific version to make failure reproducible. mypy==2.3.0 pyrefly==1.3.0.dev1 -pyright==1.1.411 +pyright==1.1.413 ty==0.0.59 # Libraries used by our various scripts. diff --git a/stdlib/@tests/test_cases/check_types.py b/stdlib/@tests/test_cases/check_types.py index d17a8b176fc8..a05ec3354dc6 100644 --- a/stdlib/@tests/test_cases/check_types.py +++ b/stdlib/@tests/test_cases/check_types.py @@ -79,7 +79,7 @@ def foo(self) -> None: union_type = int | list[_T] # ideally this would be `_SpecialForm` (Union) - assert_type(union_type | Literal[1], types.UnionType | Any) + assert_type(union_type | Literal[1], types.UnionType | Literal[1]) # Both mypy and pyright special-case this operation, # but in different ways, so we just check that no error is emitted: _ = union_type[int] From ceb3adaafeb0dddefc117f956e1ce5409cbc9ddd Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 17 Sep 2026 14:31:29 +0200 Subject: [PATCH 2/3] Fix tests --- stdlib/@tests/test_cases/check_types.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stdlib/@tests/test_cases/check_types.py b/stdlib/@tests/test_cases/check_types.py index a05ec3354dc6..ef9a13b2a2a9 100644 --- a/stdlib/@tests/test_cases/check_types.py +++ b/stdlib/@tests/test_cases/check_types.py @@ -79,7 +79,9 @@ def foo(self) -> None: union_type = int | list[_T] # ideally this would be `_SpecialForm` (Union) - assert_type(union_type | Literal[1], types.UnionType | Literal[1]) + # pyright and mypy infer different types here + assert_type(union_type | Literal[1], types.UnionType | Any) # pyright: ignore[reportAssertTypeFailure] + assert_type(union_type | Literal[1], types.UnionType | type[Literal[1]]) # type: ignore[assert-type] # Both mypy and pyright special-case this operation, # but in different ways, so we just check that no error is emitted: _ = union_type[int] From 5c1c641a45300b9c3925e252ff02df21deddd5a5 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 17 Sep 2026 14:37:12 +0200 Subject: [PATCH 3/3] Fix tests --- stdlib/@tests/test_cases/check_types.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/@tests/test_cases/check_types.py b/stdlib/@tests/test_cases/check_types.py index ef9a13b2a2a9..83040989f31f 100644 --- a/stdlib/@tests/test_cases/check_types.py +++ b/stdlib/@tests/test_cases/check_types.py @@ -78,10 +78,10 @@ def foo(self) -> None: if sys.version_info >= (3, 11): union_type = int | list[_T] - # ideally this would be `_SpecialForm` (Union) # pyright and mypy infer different types here + # ideally this would be `_SpecialForm` (Union) assert_type(union_type | Literal[1], types.UnionType | Any) # pyright: ignore[reportAssertTypeFailure] - assert_type(union_type | Literal[1], types.UnionType | type[Literal[1]]) # type: ignore[assert-type] + # assert_type(union_type | Literal[1], types.UnionType | type[Literal[1]]) # this is what pyright infers # Both mypy and pyright special-case this operation, # but in different ways, so we just check that no error is emitted: _ = union_type[int]