René's URL Explorer Experiment


Title: Crash with Generic Class and Dict · Issue #18996 · python/mypy · GitHub

Open Graph Title: Crash with Generic Class and Dict · Issue #18996 · python/mypy

X Title: Crash with Generic Class and Dict · Issue #18996 · python/mypy

Description: Crash Report I first encountered the bug on a project where I had just started trying to implement the new generic type syntax introduced in Python 3.12. I initially saw this bug with mypy 1.15 but it also occurs on the current master br...

Open Graph Description: Crash Report I first encountered the bug on a project where I had just started trying to implement the new generic type syntax introduced in Python 3.12. I initially saw this bug with mypy 1.15 but...

X Description: Crash Report I first encountered the bug on a project where I had just started trying to implement the new generic type syntax introduced in Python 3.12. I initially saw this bug with mypy 1.15 but...

Opengraph URL: https://github.com/python/mypy/issues/18996

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Crash with Generic Class and Dict","articleBody":"**Crash Report**\n\nI first encountered the bug on a project where I had just started trying to implement the new generic type syntax introduced in Python 3.12. I initially saw this bug with mypy 1.15 but it also occurs on the current master branch.\n\n**Traceback**\n\n```\nrepro.py:5: error: INTERNAL ERROR -- Please try using mypy master on GitHub:\nhttps://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build\nPlease report a bug at https://github.com/python/mypy/issues\nversion: 1.16.0+dev.7b4f6311e29452cc8d4ddb78331d0047c8b17e93\nTraceback (most recent call last):\n  File \"/home/matthew/code/mypy/venv/bin/mypy\", line 8, in \u003cmodule>\n    sys.exit(console_entry())\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/__main__.py\", line 15, in console_entry\n    main()\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/main.py\", line 127, in main\n    res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/main.py\", line 211, in run_build\n    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/build.py\", line 191, in build\n    result = _build(\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/build.py\", line 267, in _build\n    graph = dispatch(sources, manager, stdout)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/build.py\", line 2939, in dispatch\n    process_graph(graph, manager)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/build.py\", line 3337, in process_graph\n    process_stale_scc(graph, scc, manager)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/build.py\", line 3438, in process_stale_scc\n    graph[id].type_check_first_pass()\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/build.py\", line 2311, in type_check_first_pass\n    self.type_checker().check_first_pass()\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checker.py\", line 472, in check_first_pass\n    self.accept(d)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checker.py\", line 579, in accept\n    stmt.accept(self)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/nodes.py\", line 1200, in accept\n    return visitor.visit_class_def(self)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checker.py\", line 2536, in visit_class_def\n    self.accept(defn.defs)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checker.py\", line 579, in accept\n    stmt.accept(self)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/nodes.py\", line 1281, in accept\n    return visitor.visit_block(self)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checker.py\", line 3025, in visit_block\n    self.accept(s)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checker.py\", line 579, in accept\n    stmt.accept(self)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/nodes.py\", line 813, in accept\n    return visitor.visit_func_def(self)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checker.py\", line 1129, in visit_func_def\n    self._visit_func_def(defn)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checker.py\", line 1133, in _visit_func_def\n    self.check_func_item(defn, name=defn.name)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checker.py\", line 1168, in check_func_item\n    self.check_func_def(defn, typ, name, allow_empty)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checker.py\", line 1455, in check_func_def\n    self.accept(item.body)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checker.py\", line 579, in accept\n    stmt.accept(self)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/nodes.py\", line 1281, in accept\n    return visitor.visit_block(self)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checker.py\", line 3025, in visit_block\n    self.accept(s)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checker.py\", line 579, in accept\n    stmt.accept(self)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/nodes.py\", line 1301, in accept\n    return visitor.visit_expression_stmt(self)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checker.py\", line 4711, in visit_expression_stmt\n    expr_type = self.expr_checker.accept(s.expr, allow_none_return=True, always_allow_any=True)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checkexpr.py\", line 5962, in accept\n    typ = self.visit_call_expr(node, allow_none_return=True)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checkexpr.py\", line 488, in visit_call_expr\n    return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checkexpr.py\", line 578, in visit_call_expr_inner\n    self.accept(e.callee, type_context, always_allow_any=True, is_callee=True)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checkexpr.py\", line 5970, in accept\n    typ = node.accept(self)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/nodes.py\", line 1914, in accept\n    return visitor.visit_member_expr(self)\n           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checkexpr.py\", line 3342, in visit_member_expr\n    result = self.analyze_ordinary_member_access(e, is_lvalue)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checkexpr.py\", line 3372, in analyze_ordinary_member_access\n    member_type = analyze_member_access(\n        e.name,\n    ...\u003c10 lines>...\n        rvalue=rvalue,\n    )\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checkmember.py\", line 219, in analyze_member_access\n    result = _analyze_member_access(name, typ, mx, override_info)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checkmember.py\", line 238, in _analyze_member_access\n    return analyze_instance_member_access(name, typ, mx, override_info)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checkmember.py\", line 360, in analyze_instance_member_access\n    signature = check_self_arg(\n        signature, mx.self_type, method.is_class, mx.context, name, mx.msg\n    )\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/checkmember.py\", line 1038, in check_self_arg\n    if subtypes.is_subtype(\n       ~~~~~~~~~~~~~~~~~~~^\n        dispatched_arg_type,\n        ^^^^^^^^^^^^^^^^^^^^\n    ...\u003c6 lines>...\n        ignore_pos_arg_names=True,\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^\n    ):\n    ^\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/subtypes.py\", line 188, in is_subtype\n    return _is_subtype(left, right, subtype_context, proper_subtype=False)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/subtypes.py\", line 355, in _is_subtype\n    return left.accept(SubtypeVisitor(orig_right, subtype_context, proper_subtype))\n           ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/types.py\", line 1475, in accept\n    return visitor.visit_instance(self)\n           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/subtypes.py\", line 573, in visit_instance\n    infer_class_variances(right.type)\n    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/subtypes.py\", line 2152, in infer_class_variances\n    if not infer_variance(info, i):\n           ~~~~~~~~~~~~~~^^^^^^^^^\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/subtypes.py\", line 2114, in infer_variance\n    if not is_subtype(typ, typ2):\n           ~~~~~~~~~~^^^^^^^^^^^\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/subtypes.py\", line 188, in is_subtype\n    return _is_subtype(left, right, subtype_context, proper_subtype=False)\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/subtypes.py\", line 355, in _is_subtype\n    return left.accept(SubtypeVisitor(orig_right, subtype_context, proper_subtype))\n           ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/types.py\", line 3039, in accept\n    return visitor.visit_partial_type(self)\n           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^\n  File \"/home/matthew/code/mypy/venv/lib/python3.13/site-packages/mypy/subtypes.py\", line 1088, in visit_partial_type\n    raise RuntimeError(f'Partial type \"{left}\" cannot be checked with \"issubtype()\"')\nRuntimeError: Partial type \"\u003cpartial dict[?, ?]>\" cannot be checked with \"issubtype()\"\nrepro.py:5: : note: use --pdb to drop into pdb\n```\n\n**To Reproduce**\n\n`$ mypy repro.py`\n\n`repro.py`:\n```python\nclass Repro[T]:\n    def __init__(self, v) -> None:\n        self.storage = {}\n\n        self.foo()\n\n    def foo(self):\n        pass\n```\nThis is as minimal as I could get it.\n\n**Your Environment**\n\n- Mypy version used: mypy 1.16.0+dev.7b4f6311e29452cc8d4ddb78331d0047c8b17e93 (compiled: no)\n- Mypy command-line flags: None\n- Mypy configuration options from `mypy.ini` (and other config files): None\n- Python version used: Python 3.13.2\n- Operating system and version: Manjaro Linux\n","author":{"url":"https://github.com/mscheifer","@type":"Person","name":"mscheifer"},"datePublished":"2025-04-29T01:44:53Z","url":"https://github.com/python/mypy/issues/18996"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:2c329033-70c4-8270-7135-6fd75a4446a9
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEDB6:3204C8:2F851AC:3EC15F0:6B0027F5
html-safe-nonce39ada4a9d8049fc7abab2d98cf65ed0c8ea399ad496af490cb7380ea760f7367
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFREI2OjMyMDRDODoyRjg1MUFDOjNFQzE1RjA6NkIwMDI3RjUiLCJ2aXNpdG9yX2lkIjoiODYzNzg0ODUxNDUwOTk0MDcyNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac43967dd146921ed18979e8db0ce743191f963ea66d6c6414f0529b666b9e4d59
hovercard-subject-tagissue:3026716615
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/18996/issue_layout
twitter:imagehttps://opengraph.githubassets.com/251afbd8eadb8f593c0f1c31b96c18575ff55f172e67a3b71e142034944cd2ef/python/mypy/issues/18996
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/251afbd8eadb8f593c0f1c31b96c18575ff55f172e67a3b71e142034944cd2ef/python/mypy/issues/18996
og:image:altCrash Report I first encountered the bug on a project where I had just started trying to implement the new generic type syntax introduced in Python 3.12. I initially saw this bug with mypy 1.15 but...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemscheifer
hostnamegithub.com
expected-hostnamegithub.com
None4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0
turbo-cache-controlno-preview
go-importgithub.com/python/mypy git https://github.com/python/mypy.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id7053637
octolytics-dimension-repository_nwopython/mypy
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id7053637
octolytics-dimension-repository_network_root_nwopython/mypy
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release44c658b24abf00491fb7ae5f56d42c9f38cbeab2
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/18996#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F18996
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F18996
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fmypy
Reloadhttps://github.com/python/mypy/issues/18996
Reloadhttps://github.com/python/mypy/issues/18996
Reloadhttps://github.com/python/mypy/issues/18996
pythonhttps://github.com/python
mypyhttps://github.com/python/mypy
Codehttps://github.com/python/mypy
Issues2.7k (2.7k)https://github.com/python/mypy/issues
Pull requests547 (547)https://github.com/python/mypy/pulls
Actionshttps://github.com/python/mypy/actions
Projectshttps://github.com/python/mypy/projects
Wikihttps://github.com/python/mypy/wiki
Security and qualityhttps://github.com/python/mypy/security
Insightshttps://github.com/python/mypy/insights
https://github.com/python/mypy
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/18996
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/18996
Crash with Generic Class and Dicthttps://github.com/python/mypy/issues/18996#top
crashhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22crash%22
topic-pep-695Issues related to PEP 695 syntaxhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-pep-695%22
https://github.com/mscheifer
mscheiferhttps://github.com/mscheifer
on Apr 29, 2025https://github.com/python/mypy/issues/18996#issue-3026716615
mscheiferhttps://github.com/mscheifer
crashhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22crash%22
on Apr 29, 2025https://github.com/python/mypy/issues/18996#event-17445775395
hauntsaninjahttps://github.com/hauntsaninja
topic-pep-695Issues related to PEP 695 syntaxhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-pep-695%22
on Apr 29, 2025https://github.com/python/mypy/issues/18996#event-17450923392
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on Apr 29, 2025https://github.com/python/mypy/issues/18996#issuecomment-2838000616
@JukkaLhttps://github.com/JukkaL
https://github.com/sterliakov
sterliakovhttps://github.com/sterliakov
on Oct 23, 2025https://github.com/python/mypy/issues/18996#issuecomment-3439323326
#18943https://github.com/python/mypy/pull/18943
@ilevkivskyihttps://github.com/ilevkivskyi
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Oct 23, 2025https://github.com/python/mypy/issues/18996#issuecomment-3439342821
ilevkivskyihttps://github.com/ilevkivskyi
completedhttps://github.com/python/mypy/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 23, 2025https://github.com/python/mypy/issues/18996#event-20466998148
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/18996
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/18996
crashhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22crash%22
topic-pep-695Issues related to PEP 695 syntaxhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-pep-695%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.