From 5a53cc91263a2598cb4343a5cc3aabca6f3704bc Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Fri, 28 Feb 2025 19:41:11 +0100 Subject: [PATCH 1/3] Disable a pow() check pyright and mypy disagree about the exact type due to differing overloads handling. --- stdlib/@tests/test_cases/builtins/check_pow.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stdlib/@tests/test_cases/builtins/check_pow.py b/stdlib/@tests/test_cases/builtins/check_pow.py index 6fe7aacffa6e..9265f94cd08c 100644 --- a/stdlib/@tests/test_cases/builtins/check_pow.py +++ b/stdlib/@tests/test_cases/builtins/check_pow.py @@ -47,7 +47,9 @@ assert_type(complex(6) ** 6.2, complex) assert_type(pow(complex(9), 7.3, None), complex) -assert_type(pow(Fraction(), 4, None), Fraction) +# pyright infers Fraction | float | complex, while mypy infers Fraction. +# This is probably because of differences in @overload handling. +# assert_type(pow(Fraction(), 4, None), Fraction) assert_type(Fraction() ** 4, Fraction) assert_type(pow(Fraction(3, 7), complex(1, 8)), complex) From c20041337e6ac821e9d5768add83878d7154ec2c Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Mon, 3 Mar 2025 15:56:16 +0100 Subject: [PATCH 2/3] Re-enable test for mypy Co-authored-by: Avasam --- stdlib/@tests/test_cases/builtins/check_pow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/@tests/test_cases/builtins/check_pow.py b/stdlib/@tests/test_cases/builtins/check_pow.py index 9265f94cd08c..448d41ad80fe 100644 --- a/stdlib/@tests/test_cases/builtins/check_pow.py +++ b/stdlib/@tests/test_cases/builtins/check_pow.py @@ -49,7 +49,7 @@ # pyright infers Fraction | float | complex, while mypy infers Fraction. # This is probably because of differences in @overload handling. -# assert_type(pow(Fraction(), 4, None), Fraction) +assert_type(pow(Fraction(), 4, None), Fraction) # pyright: ignore[reportAssertTypeFailure] assert_type(Fraction() ** 4, Fraction) assert_type(pow(Fraction(3, 7), complex(1, 8)), complex) From 4b5e3fd374ef97c553f61ddcb06b6889049552bf Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Mon, 3 Mar 2025 16:07:57 +0100 Subject: [PATCH 3/3] Update pyright to v1.1.395 --- requirements-tests.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-tests.txt b/requirements-tests.txt index f49905636e83..1c4ad7897ed3 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -1,7 +1,7 @@ # Type checkers that we test our stubs against. These should always # be pinned to a specific version to make failure reproducible. mypy==1.15.0 -pyright==1.1.389 +pyright==1.1.395 # pytype can be installed on Windows, but requires building wheels, let's not do that on the CI pytype==2024.10.11; platform_system != "Windows" and python_version >= "3.10" and python_version < "3.13"