Skip to content

Fixed bug that results in a spurious error when running pyright on Py… - #11006

Merged
Eric Traut (erictraut) merged 1 commit into
mainfrom
issue-11003
Oct 8, 2025
Merged

Eric Traut (erictraut) merged 1 commit into
mainfrom
issue-11003

Conversation

@erictraut

Copy link
Copy Markdown
Collaborator

…thon 3.14 but configured for Python 3.13 or earlier. This addresses #11003.

…thon 3.14 but configured for Python 3.13 or earlier. This addresses #11003.
@github-actions

github-actions Bot commented Oct 8, 2025

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

sympy (https://github.com/sympy/sympy)
-   .../projects/sympy/sympy/solvers/bivariate.py:134:15 - error: Operator "-" not supported for "None" (reportOptionalOperand)
-   .../projects/sympy/sympy/solvers/bivariate.py:138:17 - error: Operator "-" not supported for type "Basic | Any | Unknown" (reportOperatorIssue)
-   .../projects/sympy/sympy/solvers/bivariate.py:143:23 - error: Operator "-" not supported for "None" (reportOptionalOperand)
-   .../projects/sympy/sympy/solvers/deutils.py:233:14 - error: Operator "not in" not supported for types "str" and "Unknown | int"
-     Operator "not in" not supported for types "str" and "int" (reportOperatorIssue)
-   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:2623:24 - error: Cannot access attribute "as_coefficients_dict" for class "Eq"
-     Attribute "as_coefficients_dict" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:2906:17 - error: Cannot access attribute "as_independent" for class "Eq"
-     Attribute "as_independent" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:313:18 - error: Argument of type "list[Iterator[Unknown | Any]]" cannot be assigned to parameter "iterable" of type "Iterable[list[bytes]]" in function "__init__" (reportArgumentType)
+   .../projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:313:18 - error: Argument of type "list[Iterator[Unknown]]" cannot be assigned to parameter "iterable" of type "Iterable[list[bytes]]" in function "__init__" (reportArgumentType)
-   .../projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:313:30 - error: Cannot access attribute "as_independent" for class "Basic"
-     Attribute "as_independent" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:382:18 - error: Argument of type "list[Iterator[Unknown | Any]]" cannot be assigned to parameter "iterable" of type "Iterable[list[bytes]]" in function "__init__" (reportArgumentType)
+   .../projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:382:18 - error: Argument of type "list[Iterator[Unknown]]" cannot be assigned to parameter "iterable" of type "Iterable[list[bytes]]" in function "__init__" (reportArgumentType)
-   .../projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:382:30 - error: Cannot access attribute "as_independent" for class "Basic"
-     Attribute "as_independent" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/solvers/ode/nonhomogeneous.py:467:28 - error: Argument of type "Unknown | Expr | Any | Eq | None" cannot be assigned to parameter "expr" of type "Expr" in function "make_args"
+   .../projects/sympy/sympy/solvers/ode/nonhomogeneous.py:467:28 - error: Argument of type "Unknown | None" cannot be assigned to parameter "expr" of type "Expr" in function "make_args"
-     Type "Unknown | Expr | Any | Eq | None" is not assignable to type "Expr"
+     Type "Unknown | None" is not assignable to type "Expr"
-       "Equality" is not assignable to "Expr" (reportArgumentType)
+       "None" is not assignable to "Expr" (reportArgumentType)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1369:17 - error: Argument of type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Unknown | Infinity | NegativeInfinity | Float | Number | Expr" cannot be assigned to parameter "value" of type "Zero" in function "__setitem__"
+   .../projects/sympy/sympy/solvers/ode/ode.py:1369:17 - error: Argument of type "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 "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Unknown | Infinity | NegativeInfinity | Float | Number | Expr" is not assignable to type "Zero"
+     Type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" is not assignable to type "Zero"
-   .../projects/sympy/sympy/solvers/ode/ode.py:2898:17 - error: Argument of type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Unknown | Infinity | NegativeInfinity | Float | Number | Expr" cannot be assigned to parameter "value" of type "Zero" in function "__setitem__"
+   .../projects/sympy/sympy/solvers/ode/ode.py:2898:17 - error: Argument of type "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 "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Unknown | Infinity | NegativeInfinity | Float | Number | Expr" is not assignable to type "Zero"
+     Type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" is not assignable to type "Zero"
-   .../projects/sympy/sympy/solvers/ode/riccati.py:869:30 - error: Argument of type "dict[Unknown, Unknown] | dict[str, str] | Unknown | Poly" cannot be assigned to parameter "obj" of type "Sized" in function "len"
+   .../projects/sympy/sympy/solvers/ode/riccati.py:869:30 - error: Argument of type "dict[Unknown, Unknown] | Unknown | Poly" cannot be assigned to parameter "obj" of type "Sized" in function "len"
-     Type "dict[Unknown, Unknown] | dict[str, str] | Unknown | Poly" is not assignable to type "Sized"
+     Type "dict[Unknown, Unknown] | Unknown | Poly" is not assignable to type "Sized"
+   .../projects/sympy/sympy/solvers/ode/single.py:865:9 - error: Expression with type "tuple[ComplexInfinity | NaN | Rational | Zero | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr | Unknown | Any, list[tuple[Unknown, Unknown]] | list[Unknown]] | tuple[ComplexInfinity | NaN | Rational | Zero | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr | Unknown | Any, list[tuple[Unknown, Unknown]] | list[Unknown], list[tuple[Unknown, Unknown]] | list[Unknown]]" cannot be assigned to target tuple
+     Type "tuple[ComplexInfinity | NaN | Rational | Zero | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr | Unknown | Any, list[tuple[Unknown, Unknown]] | list[Unknown], list[tuple[Unknown, Unknown]] | list[Unknown]]" is incompatible with target tuple
+       Tuple size mismatch; expected 2 but received 3 (reportAssignmentType)
-   .../projects/sympy/sympy/solvers/ode/single.py:1869:20 - error: Cannot access attribute "as_independent" for class "Eq"
-     Attribute "as_independent" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/solvers/ode/single.py:1872:20 - error: Cannot access attribute "coeff" for class "Eq"
-     Attribute "coeff" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/solvers/ode/single.py:1873:22 - error: "is_Rational" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/sympy/sympy/solvers/ode/single.py:1875:20 - error: Cannot access attribute "coeff" for class "Eq"
-     Attribute "coeff" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/solvers/ode/single.py:1876:22 - error: "is_Rational" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/sympy/sympy/solvers/ode/single.py:1895:25 - error: Operator "*" not supported for types "Zero | One | Expr | Unknown | Any | None" and "Zero | One | Expr | Unknown | Any | None"
-     Operator "*" not supported for types "Expr" and "None"
-     Operator "*" not supported for types "None" and "Expr"
-     Operator "*" not supported for types "None" and "None" (reportOperatorIssue)
-   .../projects/sympy/sympy/solvers/ode/single.py:1895:33 - error: Operator "*" not supported for types "Zero | One | Expr | Unknown | Any | None" and "Zero | One | Expr | Unknown | Any | None"
-     Operator "*" not supported for types "Expr" and "None"
-     Operator "*" not supported for types "None" and "Expr"
-     Operator "*" not supported for types "None" and "None" (reportOperatorIssue)
-   .../projects/sympy/sympy/solvers/ode/single.py:1904:21 - error: Operator "*" not supported for "None" (reportOptionalOperand)
-   .../projects/sympy/sympy/solvers/ode/single.py:1904:29 - error: Operator "*" not supported for "None" (reportOptionalOperand)
-   .../projects/sympy/sympy/solvers/ode/single.py:1904:44 - error: Operator "*" not supported for "None" (reportOptionalOperand)
-   .../projects/sympy/sympy/solvers/ode/single.py:1904:52 - error: Operator "*" not supported for "None" (reportOptionalOperand)
-   .../projects/sympy/sympy/solvers/ode/single.py:2636:27 - error: Argument of type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Unknown | Infinity | NegativeInfinity | Float | Number | Expr" cannot be assigned to parameter "stop" of type "SupportsIndex" in function "__new__"
+   .../projects/sympy/sympy/solvers/ode/single.py:2636:27 - error: Argument of type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" cannot be assigned to parameter "stop" of type "SupportsIndex" in function "__new__"
-     Type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Unknown | Infinity | NegativeInfinity | Float | Number | Expr" is not assignable to type "SupportsIndex"
+     Type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" is not assignable to type "SupportsIndex"
+   .../projects/sympy/sympy/solvers/pde.py:172:18 - error: Cannot access attribute "pop" for class "tuple[()]"
+     Attribute "pop" is unknown (reportAttributeAccessIssue)

... (truncated 320 lines) ...

@erictraut
Eric Traut (erictraut) merged commit 9ed33cf into main Oct 8, 2025
@erictraut
Eric Traut (erictraut) deleted the issue-11003 branch October 8, 2025 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant