Skip to content

Fixed bug that results in false positive for module attributes that a…#10972

Merged
erictraut merged 1 commit intomainfrom
issue-10692
Sep 28, 2025
Merged

Fixed bug that results in false positive for module attributes that a…#10972
erictraut merged 1 commit intomainfrom
issue-10692

Conversation

@erictraut
Copy link
Collaborator

…re synthesized for namespace modules. This addresses #10692.

…re synthesized for namespace modules. This addresses #10692.
@github-actions
Copy link
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/ode/hypergeometric.py:246:67 - error: Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/ode/lie_group.py:618:61 - error: Operator "-" not supported for type "Unknown | Basic" (reportOperatorIssue)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1515:38 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1516:38 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1526:9 - error: No overloads for "update" match the provided arguments (reportCallIssue)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1526:12 - error: "update" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1526:19 - error: Argument of type "Unknown | dict[Unknown, Unknown] | None" cannot be assigned to parameter "m" of type "Iterable[tuple[str, Unknown]]" in function "update"
-     Type "Unknown | dict[Unknown, Unknown] | None" is not assignable to type "Iterable[tuple[str, Unknown]]"
-       "None" is incompatible with protocol "Iterable[tuple[str, Unknown]]"
-         "__iter__" is not present (reportArgumentType)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1533:43 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1533:64 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1539:9 - error: No overloads for "update" match the provided arguments (reportCallIssue)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1539:12 - error: "update" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1539:19 - error: Argument of type "Unknown | dict[Unknown, Unknown] | None" cannot be assigned to parameter "m" of type "Iterable[tuple[str, Unknown]]" in function "update"
-     Type "Unknown | dict[Unknown, Unknown] | None" is not assignable to type "Iterable[tuple[str, Unknown]]"
-       "None" is incompatible with protocol "Iterable[tuple[str, Unknown]]"
-         "__iter__" is not present (reportArgumentType)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1546:43 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1546:74 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1552:9 - error: No overloads for "update" match the provided arguments (reportCallIssue)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1552:12 - error: "update" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1552:19 - error: Argument of type "Unknown | dict[Unknown, Unknown] | None" cannot be assigned to parameter "m" of type "Iterable[tuple[str, Unknown]]" in function "update"
-     Type "Unknown | dict[Unknown, Unknown] | None" is not assignable to type "Iterable[tuple[str, Unknown]]"
-       "None" is incompatible with protocol "Iterable[tuple[str, Unknown]]"
-         "__iter__" is not present (reportArgumentType)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1559:49 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1559:70 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
+   .../projects/sympy/sympy/solvers/ode/ode.py:1690:36 - error: Cannot access attribute "lhs" for class "Expr"
+     Attribute "lhs" is unknown (reportAttributeAccessIssue)
+   .../projects/sympy/sympy/solvers/ode/ode.py:1690:55 - error: Cannot access attribute "rhs" for class "Expr"
+     Attribute "rhs" is unknown (reportAttributeAccessIssue)
+   .../projects/sympy/sympy/solvers/ode/ode.py:1691:36 - error: Cannot access attribute "lhs" for class "Expr"
+     Attribute "lhs" is unknown (reportAttributeAccessIssue)
+   .../projects/sympy/sympy/solvers/ode/ode.py:1692:17 - error: No overloads for "__setitem__" match the provided arguments (reportCallIssue)
+   .../projects/sympy/sympy/solvers/ode/ode.py:1692:17 - error: Argument of type "Equality | BooleanFalse | BooleanTrue | Unknown | Expr" cannot be assigned to parameter "value" of type "Equality | BooleanFalse | BooleanTrue" in function "__setitem__"
+     Type "Equality | BooleanFalse | BooleanTrue | Unknown | Expr" is not assignable to type "Equality | BooleanFalse | BooleanTrue"
+       Type "Expr" is not assignable to type "Equality | BooleanFalse | BooleanTrue"
+         "Expr" is not assignable to "Equality"
+         "Expr" is not assignable to "BooleanFalse"
+         "Expr" is not assignable to "BooleanTrue" (reportArgumentType)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3379:7 - error: "update" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3379:38 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3380:7 - error: "update" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3380:38 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3381:14 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3382:14 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3383:14 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3395:50 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3396:50 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3397:50 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3437:5 - error: No overloads for "update" match the provided arguments (reportCallIssue)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3437:7 - error: "update" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3437:14 - error: Argument of type "Unknown | dict[Unknown, Unknown] | None" cannot be assigned to parameter "m" of type "Iterable[tuple[str, Unknown]]" in function "update"
-     Type "Unknown | dict[Unknown, Unknown] | None" is not assignable to type "Iterable[tuple[str, Unknown]]"
-       "None" is incompatible with protocol "Iterable[tuple[str, Unknown]]"
-         "__iter__" is not present (reportArgumentType)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3438:18 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3438:43 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3439:9 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3439:16 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3439:24 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3439:31 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3440:9 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3440:15 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3440:23 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3440:30 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3441:7 - error: "update" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3441:46 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3441:54 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3442:9 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3442:19 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3442:29 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3443:10 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3444:10 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3445:10 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3496:5 - error: No overloads for "update" match the provided arguments (reportCallIssue)
-   .../projects/sympy/sympy/solvers/ode/ode.py:3496:7 - error: "update" is not a known attribute of "None" (reportOptionalMemberAccess)

... (truncated 421 lines) ...

pyodide (https://github.com/pyodide/pyodide)
+   .../projects/pyodide/pyodide-build/pyodide_build/tests/test_pyzip.py:77:35 - error: "startswith" is not a known attribute of "None" (reportOptionalMemberAccess)
+   .../projects/pyodide/pyodide-build/pyodide_build/tests/test_pyzip.py:82:33 - error: "startswith" is not a known attribute of "None" (reportOptionalMemberAccess)
- 848 errors, 15 warnings, 0 informations
+ 850 errors, 15 warnings, 0 informations

streamlit (https://github.com/streamlit/streamlit)
-   .../projects/streamlit/lib/tests/streamlit/watcher/local_sources_watcher_test.py:276:40 - error: "__path__" is not a known attribute of module "tests.streamlit.watcher.test_data.namespace_package" (reportAttributeAccessIssue)
+   .../projects/streamlit/lib/tests/streamlit/watcher/local_sources_watcher_test.py:276:49 - error: Cannot access attribute "_path" for class "MutableSequence[str]"
+     Attribute "_path" is unknown (reportAttributeAccessIssue)

zulip (https://github.com/zulip/zulip)
+   .../projects/zulip/tools/setup/generate_bots_integrations_static_files.py:25:48 - error: No overloads for "abspath" match the provided arguments (reportCallIssue)
+   .../projects/zulip/tools/setup/generate_bots_integrations_static_files.py:25:64 - error: Argument of type "str | None" cannot be assigned to parameter "path" of type "AnyStr@abspath" in function "abspath"
+     Type "str | None" is not assignable to constrained type variable "AnyStr" (reportArgumentType)
- 5013 errors, 344 warnings, 0 informations
+ 5015 errors, 344 warnings, 0 informations

dd-trace-py (https://github.com/DataDog/dd-trace-py)
-   .../projects/dd-trace-py/ddtrace/contrib/internal/pyramid/patch.py:30:51 - error: "__package__" is not a known attribute of module "pyramid" (reportAttributeAccessIssue)
+   .../projects/dd-trace-py/ddtrace/contrib/internal/pyramid/patch.py:30:43 - error: Argument of type "str | None" cannot be assigned to parameter "distribution_name" of type "str" in function "version"
+     Type "str | None" is not assignable to type "str"
+       "None" is not assignable to "str" (reportArgumentType)

spark (https://github.com/apache/spark)
+   .../projects/spark/python/pyspark/errors/utils.py:260:20 - error: No overloads for "dirname" match the provided arguments (reportCallIssue)
+   .../projects/spark/python/pyspark/errors/utils.py:260:36 - error: Argument of type "str | None" cannot be assigned to parameter "p" of type "AnyOrLiteralStr@dirname" in function "dirname"
+     Type "str | None" is not assignable to constrained type variable "AnyOrLiteralStr" (reportArgumentType)
+   .../projects/spark/python/pyspark/errors/utils.py:261:26 - error: No overloads for "dirname" match the provided arguments (reportCallIssue)
+   .../projects/spark/python/pyspark/errors/utils.py:261:42 - error: Argument of type "str | None" cannot be assigned to parameter "p" of type "AnyOrLiteralStr@dirname" in function "dirname"
+     Type "str | None" is not assignable to constrained type variable "AnyOrLiteralStr" (reportArgumentType)
- 27933 errors, 844 warnings, 0 informations
+ 27937 errors, 844 warnings, 0 informations

pwndbg (https://github.com/pwndbg/pwndbg)
+   .../projects/pwndbg/pwndbg/lib/zig.py:102:22 - error: No overloads for "dirname" match the provided arguments (reportCallIssue)
+   .../projects/pwndbg/pwndbg/lib/zig.py:102:38 - error: Argument of type "str | None" cannot be assigned to parameter "p" of type "AnyOrLiteralStr@dirname" in function "dirname"
+     Type "str | None" is not assignable to constrained type variable "AnyOrLiteralStr" (reportArgumentType)
+   .../projects/pwndbg/pwndbg/lib/zig.py:146:30 - error: No overloads for "dirname" match the provided arguments (reportCallIssue)
+   .../projects/pwndbg/pwndbg/lib/zig.py:146:46 - error: Argument of type "str | None" cannot be assigned to parameter "p" of type "AnyOrLiteralStr@dirname" in function "dirname"
+     Type "str | None" is not assignable to constrained type variable "AnyOrLiteralStr" (reportArgumentType)
+   .../projects/pwndbg/pwndbg/lib/zig.py:165:30 - error: No overloads for "dirname" match the provided arguments (reportCallIssue)
+   .../projects/pwndbg/pwndbg/lib/zig.py:165:46 - error: Argument of type "str | None" cannot be assigned to parameter "p" of type "AnyOrLiteralStr@dirname" in function "dirname"
+     Type "str | None" is not assignable to constrained type variable "AnyOrLiteralStr" (reportArgumentType)
- 3020 errors, 99 warnings, 0 informations
+ 3026 errors, 99 warnings, 0 informations

optuna (https://github.com/optuna/optuna)
+   .../projects/optuna/optuna/integration/lightgbm.py:40:16 - error: "__getitem__" method not defined on type "property" (reportIndexIssue)
- 812 errors, 29 warnings, 0 informations
+ 813 errors, 29 warnings, 0 informations

jax (https://github.com/google/jax)
-   .../projects/jax/jax/_src/ffi.py:134:55 - error: "__file__" is not a known attribute of module "jaxlib" (reportAttributeAccessIssue)
+   .../projects/jax/jax/_src/ffi.py:134:32 - error: No overloads for "abspath" match the provided arguments (reportCallIssue)
+   .../projects/jax/jax/_src/ffi.py:134:48 - error: Argument of type "str | None" cannot be assigned to parameter "path" of type "AnyStr@abspath" in function "abspath"
+     Type "str | None" is not assignable to constrained type variable "AnyStr" (reportArgumentType)
+   .../projects/jax/jax/experimental/jax2tf/jax2tf.py:255:43 - error: No overloads for "dirname" match the provided arguments (reportCallIssue)
+   .../projects/jax/jax/experimental/jax2tf/jax2tf.py:255:59 - error: Argument of type "str | None" cannot be assigned to parameter "p" of type "AnyOrLiteralStr@dirname" in function "dirname"
+     Type "str | None" is not assignable to constrained type variable "AnyOrLiteralStr" (reportArgumentType)
- 4180 errors, 57 warnings, 0 informations
+ 4183 errors, 57 warnings, 0 informations

@erictraut erictraut merged commit 38317d6 into main Sep 28, 2025
20 checks passed
@erictraut erictraut deleted the issue-10692 branch September 28, 2025 06:01
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