Title: AssertionError: Must not defer during final iteration · Issue #17716 · python/mypy · GitHub
Open Graph Title: AssertionError: Must not defer during final iteration · Issue #17716 · python/mypy
X Title: AssertionError: Must not defer during final iteration · Issue #17716 · python/mypy
Description: Crash Report this could be related to #15927, but that ticket is related to python 3.10; mine is specific to python 3.13's new TypeVar(..., default=...) argument (the default argument is why i chose python 3.13 for my project 😃). the min...
Open Graph Description: Crash Report this could be related to #15927, but that ticket is related to python 3.10; mine is specific to python 3.13's new TypeVar(..., default=...) argument (the default argument is why i chos...
X Description: Crash Report this could be related to #15927, but that ticket is related to python 3.10; mine is specific to python 3.13's new TypeVar(..., default=...) argument (the default argument is why i ...
Opengraph URL: https://github.com/python/mypy/issues/17716
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"AssertionError: Must not defer during final iteration","articleBody":"**Crash Report**\r\n\r\nthis could be related to #15927, but that ticket is related to python 3.10; mine is specific to python 3.13's new `TypeVar(..., default=...)` argument (the default argument is why i chose python 3.13 for my project :smiley:).\r\n\r\nthe minimal example below in the appropriate section uses `TypeVar` and `Generic` and produces a crash. i saw the traceback requesting that i try again on the main branch, pulled the main branch and tried again, and the traceback occurred again. so here it is!\r\n\r\nSpecifically, to get the mypy main branch, i did `git clone`, then from inside my project i did `poetry add ../../mypy`\r\n\r\n**Traceback**\r\n\r\n```\r\n$ poetry run mypy --strict --show-traceback craftgrid/game_node.py \r\ncraftgrid/game_node.py:4: error: INTERNAL ERROR -- Please try using mypy master on GitHub:\r\nhttps://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build\r\nPlease report a bug at https://github.com/python/mypy/issues\r\nversion: 1.12.0+dev.fe15ee69b9225f808f8ed735671b73c31ae1bed8\r\nTraceback (most recent call last):\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/bin/mypy\", line 8, in \u003cmodule>\r\n sys.exit(console_entry())\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/__main__.py\", line 15, in console_entry\r\n main()\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/main.py\", line 102, in main\r\n res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/main.py\", line 186, in run_build\r\n res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/build.py\", line 193, in build\r\n result = _build(\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/build.py\", line 268, in _build\r\n graph = dispatch(sources, manager, stdout)\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/build.py\", line 2950, in dispatch\r\n process_graph(graph, manager)\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/build.py\", line 3348, in process_graph\r\n process_stale_scc(graph, scc, manager)\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/build.py\", line 3443, in process_stale_scc\r\n mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal_main.py\", line 93, in semantic_analysis_for_scc\r\n process_top_levels(graph, scc, patches)\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal_main.py\", line 220, in process_top_levels\r\n deferred, incomplete, progress = semantic_analyze_target(\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal_main.py\", line 351, in semantic_analyze_target\r\n analyzer.refresh_partial(\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal.py\", line 619, in refresh_partial\r\n self.refresh_top_level(node)\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal.py\", line 630, in refresh_top_level\r\n self.accept(d)\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal.py\", line 7087, in accept\r\n node.accept(self)\r\n ~~~~~~~~~~~^^^^^^\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/nodes.py\", line 1183, in accept\r\n return visitor.visit_class_def(self)\r\n ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal.py\", line 1700, in visit_class_def\r\n self.analyze_class(defn)\r\n ~~~~~~~~~~~~~~~~~~^^^^^^\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal.py\", line 1828, in analyze_class\r\n self.defer()\r\n ~~~~~~~~~~^^\r\n File \"/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal.py\", line 6742, in defer\r\n assert not self.final_iteration, \"Must not defer during final iteration\"\r\n ^^^^^^^^^^^^^^^^^^^^^^^^\r\nAssertionError: Must not defer during final iteration\r\ncraftgrid/game_node.py:4: : note: use --pdb to drop into pdb\r\n```\r\n\r\n**To Reproduce**\r\n\r\n```python\r\nfrom typing import TypeVar, Generic\r\n\r\n\r\nclass GameNode(Generic['GameNodeType']):\r\n pass\r\n\r\n\r\nGameNodeType = TypeVar('GameNodeType', bound=GameNode, default=GameNode)\r\n```\r\n\r\n**Your Environment**\r\n\r\n- Mypy version used: newest from main branch as of right now, `1.12.0+dev.fe15ee69b9225f808f8ed735671b73c31ae1bed8`\r\n- Mypy command-line flags: `poetry run mypy --strict --show-traceback craftgrid/game_node.py`\r\n- Mypy configuration options from `mypy.ini` (and other config files):\r\n- Python version used: `3.13.0rc1`\r\n- Operating system and version: `6.6.41-gentoo-dist`\r\n","author":{"url":"https://github.com/violet4","@type":"Person","name":"violet4"},"datePublished":"2024-08-29T01:32:11Z","url":"https://github.com/python/mypy/issues/17716"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3c2ae7c3-d49e-baa4-22de-13cdded1def2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BD0A:1AC37C:3E035B:534C78:6B002AFB |
| html-safe-nonce | d30d928fcee796fb3681bf2194025f017df4fd9e21bbaba2a3180a353468307f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDBBOjFBQzM3QzozRTAzNUI6NTM0Qzc4OjZCMDAyQUZCIiwidmlzaXRvcl9pZCI6IjEyNjQ0ODQ3NDY0OTk0NjgwMjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | effa8fbdaef809505bb271a4d61f067f75c442d413a89d40c72bb91452cfa2ce |
| hovercard-subject-tag | issue:2493268620 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/17716/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2eeeec7cf34668a860dc44079627e8289b92dfec369a374f44974519ba21a46d/python/mypy/issues/17716 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2eeeec7cf34668a860dc44079627e8289b92dfec369a374f44974519ba21a46d/python/mypy/issues/17716 |
| og:image:alt | Crash Report this could be related to #15927, but that ticket is related to python 3.10; mine is specific to python 3.13's new TypeVar(..., default=...) argument (the default argument is why i chos... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | violet4 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width