Skip to content

Conversation

@guilhermesenko
Copy link

Refactor partial types to avoid code duplication (#8043)

Overview

This refactors the partial-type handling paths so that assignments, augmented assignments, and indexed assignments all share the same inference routine. It keeps the previous behaviour intact while removing the duplicated logic that previously lived in check_assignment, try_infer_partial_generic_type_from_assignment, and try_infer_partial_type_from_indexed_assignment.

Changes

  • Introduced try_resolve_partial_type_from_assignment, which encapsulates partial-None and generic-partial inference, binder updates, and scope clean‑up.
  • Invoked the helper from normal assignments, operator assignments, and indexed assignments, including a lightweight “pre-check” step so the lvalue follows the original control flow.
  • Reworked indexed assignments to reuse the shared helper (via _get_partial_assignment_target) instead of duplicating inference paths.
  • Preserved all legacy edge cases: literal None reassignments, Optional widening, defaultdict value consistency, and inference cancellation when we fall back to SetNothingToAny.

Testing

  • python -m compileall mypy/checker.py
  • python -m pytest mypy/test/testcheck.py -k "PartiallyInitialized"
  • python -m pytest mypy/test/testcheck.py -k "NoCrashOnPartial"
  • python -m pytest mypy/test/testcheck.py -k "NewRedefinePartialTypeForInstanceVariable"
  • python -m pytest mypy/test/testfinegrained.py -k "RefreshPartialTypeInferredAttributeAssign"
  • python -m pytest mypy/test/testcheck.py -k "RejectsPartialWithUninhabited"
  • python -m pytest -k partial -n0

@guilhermesenko guilhermesenko force-pushed the fix-partial-type-refactor branch from c34a8da to dc75e68 Compare November 6, 2025 04:33
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

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

optuna (https://github.com/optuna/optuna)
- optuna/_gp/gp.py:177: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/_gp/gp.py:278: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/_gp/gp.py:287: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/_gp/gp.py:289: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/_gp/gp.py:291: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/_gp/optim_mixed.py:66: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/_gp/optim_mixed.py:67: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/_gp/acqf.py:37: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/_gp/acqf.py:112: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/_gp/acqf.py:113: error: Unused "type: ignore" comment  [unused-ignore]
- tests/gp_tests/test_acqf.py:17: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/visualization/matplotlib/_timeline.py:85: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/visualization/matplotlib/_timeline.py:86: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/visualization/matplotlib/_timeline.py:107: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/visualization/matplotlib/_timeline.py:108: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/visualization/matplotlib/_timeline.py:111: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/visualization/matplotlib/_rank.py:100: error: Unused "type: ignore" comment  [unused-ignore]
+ Traceback (most recent call last):
+   File "/tmp/mypy_primer/mypy_new/venv/bin/mypy", line 7, in <module>
+     sys.exit(console_entry())
+              ~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+     main()
+     ~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 127, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+                               ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 211, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 215, in build
+     result = _build(
+         sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr, extra_plugins
+     )
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 294, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2941, in dispatch
+     process_graph(graph, manager)
+     ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3332, in process_graph
+     done, still_working = manager.wait_for_done(graph)
+                           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 917, in wait_for_done
+     process_stale_scc(graph, next_scc, self)
+     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3498, in process_stale_scc
+     meta_tuples[id] = graph[id].write_cache()
+                       ~~~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2489, in write_cache
+     self.tree.serialize()
+     ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 424, in serialize
+     "names": self.names.serialize(self._fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 3898, in serialize
+     "names": self.names.serialize(self.fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 1334, in serialize
+     "type": None if self.type is None else self.type.serialize(),
+                                            ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/types.py", line 309, in serialize
+     raise NotImplementedError(f"Cannot serialize {self.__class__.__name__} instance")
+ NotImplementedError: Cannot serialize PartialType instance
+ Error serializing sqlalchemy.orm.instrumentation

spark (https://github.com/apache/spark)
+ python/pyspark/streaming/context.py:109: error: Incompatible types in assignment (expression has type "TransformFunctionSerializer", variable has type "object")  [assignment]
+ python/pyspark/streaming/context.py:227: error: Incompatible types in assignment (expression has type "StreamingContext", variable has type "object")  [assignment]
+ python/pyspark/streaming/context.py:270: error: Incompatible types in assignment (expression has type "None", variable has type "object")  [assignment]

tornado (https://github.com/tornadoweb/tornado)
+ Traceback (most recent call last):
+   File "/tmp/mypy_primer/mypy_new/venv/bin/mypy", line 7, in <module>
+     sys.exit(console_entry())
+              ~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+     main()
+     ~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 127, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+                               ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 211, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 215, in build
+     result = _build(
+         sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr, extra_plugins
+     )
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 294, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2941, in dispatch
+     process_graph(graph, manager)
+     ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3332, in process_graph
+     done, still_working = manager.wait_for_done(graph)
+                           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 917, in wait_for_done
+     process_stale_scc(graph, next_scc, self)
+     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3498, in process_stale_scc
+     meta_tuples[id] = graph[id].write_cache()
+                       ~~~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2489, in write_cache
+     self.tree.serialize()
+     ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 424, in serialize
+     "names": self.names.serialize(self._fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 3898, in serialize
+     "names": self.names.serialize(self.fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 1334, in serialize
+     "type": None if self.type is None else self.type.serialize(),
+                                            ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/types.py", line 309, in serialize
+     raise NotImplementedError(f"Cannot serialize {self.__class__.__name__} instance")
+ NotImplementedError: Cannot serialize PartialType instance
+ tornado/netutil.py:533: error: Incompatible types in assignment (expression has type "None", variable has type "object")  [assignment]
+ tornado/netutil.py:535: error: Incompatible types in assignment (expression has type "ThreadPoolExecutor", variable has type "object")  [assignment]
+ tornado/netutil.py:537: error: Incompatible return value type (got "None", expected "ThreadPoolExecutor")  [return-value]
+ Error serializing tornado.web
- tornado/testing.py:860: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/wsgi.py:180: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/util.py:82: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/locks_test.py:102: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/auth_test.py:78: error: Signature of "_oauth_get_user_future" incompatible with supertype "tornado.auth.OAuthMixin"  [override]
- tornado/test/auth_test.py:78: note:      Superclass:
- tornado/test/auth_test.py:78: note:          def _oauth_get_user_future(self, access_token: dict[str, Any]) -> Coroutine[Any, Any, dict[str, Any]]
- tornado/test/auth_test.py:78: note:      Subclass:
- tornado/test/auth_test.py:78: note:          def _oauth_get_user_future(*Any, **Any) -> Future[Any]
- tornado/test/web_test.py:736: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/web_test.py:1562: error: Signature of "make_static_url" incompatible with supertype "tornado.web.StaticFileHandler"  [override]
- tornado/test/web_test.py:1562: note:      Superclass:
- tornado/test/web_test.py:1562: note:          @classmethod
- tornado/test/web_test.py:1562: note:          def make_static_url(cls, settings: dict[str, Any], path: str, include_version: bool = ...) -> str
- tornado/test/web_test.py:1562: note:      Subclass:
- tornado/test/web_test.py:1562: note:          @classmethod
- tornado/test/web_test.py:1562: note:          def make_static_url(cls, settings: Any, path: Any) -> Any
- tornado/test/web_test.py:2228: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/web_test.py:2243: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/web_test.py:2653: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/web_test.py:2948: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/tcpserver_test.py:81: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/runtests.py:84: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/runtests.py:90: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/runtests.py:186: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/ioloop_test.py:54: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/ioloop_test.py:55: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/httpserver_test.py:69: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/httpserver_test.py:126: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/httpserver_test.py:137: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/httpclient_test.py:124: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/httpclient_test.py:130: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/httpclient_test.py:304: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/httpclient_test.py:622: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/httpclient_test.py:798: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/httpclient_test.py:906: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/httpclient_test.py:920: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/asyncio_test.py:256: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/asyncio_test.py:266: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/asyncio_test.py:270: error: Unused "type: ignore" comment  [unused-ignore]
- tornado/test/simple_httpclient_test.py:399: error: Unused "type: ignore" comment  [unused-ignore]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/synchronous/encryption.py:417: error: Incompatible types in assignment (expression has type "MongoClient[Any]", variable has type "object")  [assignment]
+ pymongo/asynchronous/encryption.py:420: error: Incompatible types in assignment (expression has type "AsyncMongoClient[Any]", variable has type "object")  [assignment]

scrapy (https://github.com/scrapy/scrapy)
+ scrapy/commands/parse.py:347: error: Incompatible types in assignment (expression has type "Response", variable has type "object")  [assignment]

pytest (https://github.com/pytest-dev/pytest)
+ Traceback (most recent call last):
+   File "/tmp/mypy_primer/mypy_new/venv/bin/mypy", line 7, in <module>
+     sys.exit(console_entry())
+              ~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+     main()
+     ~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 127, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+                               ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 211, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 215, in build
+     result = _build(
+         sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr, extra_plugins
+     )
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 294, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2941, in dispatch
+     process_graph(graph, manager)
+     ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3332, in process_graph
+     done, still_working = manager.wait_for_done(graph)
+                           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 917, in wait_for_done
+     process_stale_scc(graph, next_scc, self)
+     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3498, in process_stale_scc
+     meta_tuples[id] = graph[id].write_cache()
+                       ~~~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2489, in write_cache
+     self.tree.serialize()
+     ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 424, in serialize
+     "names": self.names.serialize(self._fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 3898, in serialize
+     "names": self.names.serialize(self.fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 1334, in serialize
+     "type": None if self.type is None else self.type.serialize(),
+                                            ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/types.py", line 309, in serialize
+     raise NotImplementedError(f"Cannot serialize {self.__class__.__name__} instance")
+ NotImplementedError: Cannot serialize PartialType instance
+ Error serializing _pytest.subtests
- testing/typing_raises_group.py:109: error: Unused "type: ignore" comment  [unused-ignore]
- testing/typing_raises_group.py:112: error: Unused "type: ignore" comment  [unused-ignore]
- testing/typing_raises_group.py:116: error: Unused "type: ignore" comment  [unused-ignore]
- testing/typing_raises_group.py:119: error: Unused "type: ignore" comment  [unused-ignore]
- testing/typing_raises_group.py:123: error: Unused "type: ignore" comment  [unused-ignore]
- testing/typing_raises_group.py:124: error: Unused "type: ignore" comment  [unused-ignore]
- testing/_py/test_local.py:855: error: Item "None" of "local | None" has no attribute "check"  [union-attr]
- testing/_py/test_local.py:858: error: Item "None" of "local | None" has no attribute "dirpath"  [union-attr]
- testing/_py/test_local.py:909: error: Item "None" of "local | None" has no attribute "check"  [union-attr]
- testing/_py/test_local.py:911: error: Item "None" of "local | None" has no attribute "check"  [union-attr]
- testing/_py/test_local.py:920: error: Item "None" of "local | None" has no attribute "basename"  [union-attr]
- testing/_py/test_local.py:921: error: Item "None" of "local | None" has no attribute "dirpath"  [union-attr]
- testing/_py/test_local.py:922: error: Argument "checker" to "sysfind" of "local" has incompatible type "Callable[[local], None]"; expected "Callable[[local], bool] | None"  [arg-type]
- testing/_py/test_local.py:922: error: Incompatible return value type (got "None", expected "bool")  [return-value]
- testing/_py/test_local.py:926: error: Item "None" of "local | None" has no attribute "sysexec"  [union-attr]
- testing/_py/test_local.py:934: error: Cannot assign to a type  [misc]
- testing/_py/test_local.py:934: error: Incompatible types in assignment (expression has type "type[RuntimeError]", variable has type "type[ExecutionFailed]")  [assignment]
- testing/_py/test_local.py:937: error: Item "None" of "local | None" has no attribute "sysexec"  [union-attr]
- testing/_py/test_local.py:1173: error: Module "py.path" has no attribute "isimportable"  [attr-defined]
- testing/_py/test_local.py:1190: error: "type[local]" has no attribute "_gethomedir"  [attr-defined]
- testing/_py/test_local.py:1196: error: "type[local]" has no attribute "_gethomedir"  [attr-defined]
- testing/_py/test_local.py:1278: error: Item "None" of "local | None" has no attribute "new"  [union-attr]
- testing/_py/test_local.py:1280: error: Item "None" of "local | None" has no attribute "relto"  [union-attr]
- testing/_py/test_local.py:1281: error: Item "None" of "local | None" has no attribute "check"  [union-attr]

django-stubs (https://github.com/typeddjango/django-stubs)
+ Traceback (most recent call last):
+   File "/tmp/mypy_primer/mypy_new/venv/bin/mypy", line 7, in <module>
+     sys.exit(console_entry())
+              ~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+     main()
+     ~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 127, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+                               ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 211, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 215, in build
+     result = _build(
+         sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr, extra_plugins
+     )
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 294, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2941, in dispatch
+     process_graph(graph, manager)
+     ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3332, in process_graph
+     done, still_working = manager.wait_for_done(graph)
+                           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 917, in wait_for_done
+     process_stale_scc(graph, next_scc, self)
+     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3498, in process_stale_scc
+     meta_tuples[id] = graph[id].write_cache()
+                       ~~~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2489, in write_cache
+     self.tree.serialize()
+     ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 424, in serialize
+     "names": self.names.serialize(self._fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 3898, in serialize
+     "names": self.names.serialize(self.fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 1334, in serialize
+     "type": None if self.type is None else self.type.serialize(),
+                                            ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/types.py", line 309, in serialize
+     raise NotImplementedError(f"Cannot serialize {self.__class__.__name__} instance")
+ NotImplementedError: Cannot serialize PartialType instance
+ Error serializing redis.connection

egglog-python (https://github.com/egraphs-good/egglog-python)
+ Traceback (most recent call last):
+   File "/tmp/mypy_primer/mypy_new/venv/bin/mypy", line 7, in <module>
+     sys.exit(console_entry())
+              ~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+     main()
+     ~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 127, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+                               ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 211, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 215, in build
+     result = _build(
+         sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr, extra_plugins
+     )
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 294, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2941, in dispatch
+     process_graph(graph, manager)
+     ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3332, in process_graph
+     done, still_working = manager.wait_for_done(graph)
+                           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 917, in wait_for_done
+     process_stale_scc(graph, next_scc, self)
+     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3498, in process_stale_scc
+     meta_tuples[id] = graph[id].write_cache()
+                       ~~~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2489, in write_cache
+     self.tree.serialize()
+     ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 424, in serialize
+     "names": self.names.serialize(self._fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 3898, in serialize
+     "names": self.names.serialize(self.fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 1334, in serialize
+     "type": None if self.type is None else self.type.serialize(),
+                                            ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/types.py", line 309, in serialize
+     raise NotImplementedError(f"Cannot serialize {self.__class__.__name__} instance")
+ NotImplementedError: Cannot serialize PartialType instance
+ Error serializing executing.executing

pandas (https://github.com/pandas-dev/pandas)
+ Traceback (most recent call last):
+   File "/tmp/mypy_primer/mypy_new/venv/bin/mypy", line 7, in <module>
+     sys.exit(console_entry())
+              ~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+     main()
+     ~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 127, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+                               ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 211, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 215, in build
+     result = _build(
+         sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr, extra_plugins
+     )
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 294, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2941, in dispatch
+     process_graph(graph, manager)
+     ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3332, in process_graph
+     done, still_working = manager.wait_for_done(graph)
+                           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 917, in wait_for_done
+     process_stale_scc(graph, next_scc, self)
+     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3498, in process_stale_scc
+     meta_tuples[id] = graph[id].write_cache()
+                       ~~~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2489, in write_cache
+     self.tree.serialize()
+     ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 424, in serialize
+     "names": self.names.serialize(self._fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 3898, in serialize
+     "names": self.names.serialize(self.fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 1334, in serialize
+     "type": None if self.type is None else self.type.serialize(),
+                                            ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/types.py", line 309, in serialize
+     raise NotImplementedError(f"Cannot serialize {self.__class__.__name__} instance")
+ NotImplementedError: Cannot serialize PartialType instance
+ Error serializing pandas.core.computation.pytables
- pandas/tests/scalar/timedelta/test_timedelta.py:594: error: Untyped decorator makes function "test_hash_equality_invariance" untyped  [untyped-decorator]
- pandas/plotting/_matplotlib/tools.py:59: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:84: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:447: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:451: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:463: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:465: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:467: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:469: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/style.py:289: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:378: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:379: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:381: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:382: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:997: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/tests/io/test_sql.py:241: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/tests/io/test_sql.py:247: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/tests/io/test_sql.py:250: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/tests/io/test_sql.py:600: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:136: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:149: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:167: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:170: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:173: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:549: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:551: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:552: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:555: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1286: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1287: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1644: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1649: error: Unused "type: ignore[attr-defined]" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1666: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1669: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1671: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1673: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1689: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1695: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1712: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1715: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1731: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1805: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1808: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:2122: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:2191: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:2194: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/hist.py:176: error: Unused "type: ignore[index, arg-type]" comment  [unused-ignore]
- pandas/plotting/_matplotlib/hist.py:207: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/hist.py:209: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/hist.py:211: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/hist.py:213: error: Unused "type: ignore" comment  [unused-ignore]

dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/_trace/tracer.py:123: error: Incompatible types in assignment (expression has type "Tracer", variable has type "object")  [assignment]

trio (https://github.com/python-trio/trio)
+ Traceback (most recent call last):
+   File "/tmp/mypy_primer/mypy_new/venv/bin/mypy", line 7, in <module>
+     sys.exit(console_entry())
+              ~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+     main()
+     ~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 127, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+                               ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 211, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 215, in build
+     result = _build(
+         sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr, extra_plugins
+     )
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 294, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2941, in dispatch
+     process_graph(graph, manager)
+     ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3332, in process_graph
+     done, still_working = manager.wait_for_done(graph)
+                           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 917, in wait_for_done
+     process_stale_scc(graph, next_scc, self)
+     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3498, in process_stale_scc
+     meta_tuples[id] = graph[id].write_cache()
+                       ~~~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2489, in write_cache
+     self.tree.serialize()
+     ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 424, in serialize
+     "names": self.names.serialize(self._fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 3898, in serialize
+     "names": self.names.serialize(self.fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 1334, in serialize
+     "type": None if self.type is None else self.type.serialize(),
+                                            ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/types.py", line 309, in serialize
+     raise NotImplementedError(f"Cannot serialize {self.__class__.__name__} instance")
+ NotImplementedError: Cannot serialize PartialType instance
+ Error serializing trio._dtls
- src/trio/_tests/tools/test_sync_requirements.py:10: error: Library stubs not installed for "yaml"  [import-untyped]
- src/trio/_tests/tools/test_sync_requirements.py:10: note: Hint: "python3 -m pip install types-PyYAML"
- src/trio/_tests/tools/test_sync_requirements.py:10: note: (or run "mypy --install-types" to install all missing stub packages)
- src/trio/_tests/tools/test_sync_requirements.py:10: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
- src/trio/_tests/test_exports.py:163: error: Unused "type: ignore" comment  [unused-ignore]
- src/trio/_core/_tests/test_ki.py:167: error: Unused "type: ignore" comment  [unused-ignore]
- src/trio/_core/_tests/test_ki.py:167: error: Untyped decorator makes function "agen_protected1" untyped  [untyped-decorator]
- src/trio/_core/_tests/test_ki.py:167: note: Error code "untyped-decorator" not covered by "type: ignore" comment
- src/trio/_core/_tests/test_ki.py:176: error: Unused "type: ignore" comment  [unused-ignore]
- src/trio/_core/_tests/test_ki.py:176: error: Untyped decorator makes function "agen_unprotected1" untyped  [untyped-decorator]
- src/trio/_core/_tests/test_ki.py:176: note: Error code "untyped-decorator" not covered by "type: ignore" comment
- src/trio/_core/_tests/test_ki.py:185: error: Unused "type: ignore" comment  [unused-ignore]
- src/trio/_core/_tests/test_ki.py:185: error: Untyped decorator makes function "agen_protected2" untyped  [untyped-decorator]
- src/trio/_core/_tests/test_ki.py:185: note: Error code "untyped-decorator" not covered by "type: ignore" comment
- src/trio/_core/_tests/test_ki.py:194: error: Unused "type: ignore" comment  [unused-ignore]
- src/trio/_core/_tests/test_ki.py:194: error: Untyped decorator makes function "agen_unprotected2" untyped  [untyped-decorator]
- src/trio/_core/_tests/test_ki.py:194: note: Error code "untyped-decorator" not covered by "type: ignore" comment

jax (https://github.com/google/jax)
+ Traceback (most recent call last):
+   File "/tmp/mypy_primer/mypy_new/venv/bin/mypy", line 7, in <module>
+     sys.exit(console_entry())
+              ~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+     main()
+     ~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 127, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+                               ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/main.py", line 211, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 215, in build
+     result = _build(
+         sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr, extra_plugins
+     )
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 294, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2941, in dispatch
+     process_graph(graph, manager)
+     ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3332, in process_graph
+     done, still_working = manager.wait_for_done(graph)
+                           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 917, in wait_for_done
+     process_stale_scc(graph, next_scc, self)
+     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 3498, in process_stale_scc
+     meta_tuples[id] = graph[id].write_cache()
+                       ~~~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/build.py", line 2489, in write_cache
+     self.tree.serialize()
+     ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 424, in serialize
+     "names": self.names.serialize(self._fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 3898, in serialize
+     "names": self.names.serialize(self.fullname),
+              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4741, in serialize
+     data[key] = value.serialize(fullname, key)
+                 ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 4630, in serialize
+     data["node"] = self.node.serialize()
+                    ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/nodes.py", line 1334, in serialize
+     "type": None if self.type is None else self.type.serialize(),
+                                            ~~~~~~~~~~~~~~~~~~~^^
+   File "/tmp/mypy_primer/mypy_new/venv/lib/python3.13/site-packages/mypy/types.py", line 309, in serialize
+     raise NotImplementedError(f"Cannot serialize {self.__class__.__name__} instance")
+ NotImplementedError: Cannot serialize PartialType instance
+ Error serializing jax._src.export.shape_poly
- jax/_src/callback.py:865: error: Unused "type: ignore" comment  [unused-ignore]
- jax/_src/callback.py:873: error: Unused "type: ignore" comment  [unused-ignore]
- jax/_src/callback.py:876: error: Unused "type: ignore" comment  [unused-ignore]
- jax/_src/callback.py:878: error: Unused "type: ignore" comment  [unused-ignore]
- jax/_src/lax/slicing.py:2435: error: Unused "type: ignore" comment  [unused-ignore]
- jax/_src/lax/lax.py:3625: error: Unused "type: ignore" comment  [unused-ignore]
- jax/_src/state/primitives.py:80: error: Unused "type: ignore" comment  [unused-ignore]
- jax/_src/state/primitives.py:187: error: Unused "type: ignore" comment  [unused-ignore]
- jax/_src/state/primitives.py:814: error: Unused "type: ignore" comment  [unused-ignore]
- jax/_src/numpy/util.py:101: error: Unused "type: ignore" comment  [unused-ignore]
- jax/_src/numpy/util.py:418: error: Unused "type: ignore" comment  [unused-ignore]
- jax/_src/export/_export.py:709: error: Unused "type: ignore" comment  [unused-ignore]
- jax/_src/export/_export.py:746: error: Unused "type: ignore" comment  [unused-ignore]
- jax/_src/export/_export.py:790: error: Unused "type: ignore" comment  [unused-ignore]
- jax/_src/export/_export.py:822: error: Unused "type: ignore" comment  [unused-ignore]
- jax/_src/export/_export.py:867: error: Unused "type: ignore" comment  [unused-ignore]

... (truncated 628 lines) ...```

@guilhermesenko
Copy link
Author

Fixed a follow-up typing regression in visit_operator_assignment_stmt

@guilhermesenko guilhermesenko marked this pull request as ready for review November 6, 2025 05:05
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