René's URL Explorer Experiment


Title: Several dataclass crashes involving Final attributes · Issue #10090 · python/mypy · GitHub

Open Graph Title: Several dataclass crashes involving Final attributes · Issue #10090 · python/mypy

X Title: Several dataclass crashes involving Final attributes · Issue #10090 · python/mypy

Description: Crash Report I was just trying things out and found a crash with: from dataclasses import dataclass from typing import Final @dataclass class FirstClass: FIRST_CONST: Final = 3 @dataclass # mypy runs fine if this isn't a dataclass class ...

Open Graph Description: Crash Report I was just trying things out and found a crash with: from dataclasses import dataclass from typing import Final @dataclass class FirstClass: FIRST_CONST: Final = 3 @dataclass # mypy ru...

X Description: Crash Report I was just trying things out and found a crash with: from dataclasses import dataclass from typing import Final @dataclass class FirstClass: FIRST_CONST: Final = 3 @dataclass # mypy ru...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Several dataclass crashes involving Final attributes","articleBody":"\u003c!--\r\n  Use this form only if mypy reports an \"INTERNAL ERROR\" and/or gives a traceback.\r\n  Please include the traceback and all other messages below (use `mypy --show-traceback`).\r\n-->\r\n\r\n**Crash Report**\r\n\r\nI was just trying things out and found a crash with:\r\n\r\n```python\r\nfrom dataclasses import dataclass\r\nfrom typing import Final\r\n\r\n@dataclass\r\nclass FirstClass:\r\n    FIRST_CONST: Final = 3\r\n\r\n@dataclass  # mypy runs fine if this isn't a dataclass\r\nclass SecondClass:\r\n    SECOND_CONST: Final = FirstClass.FIRST_CONST\r\n```\r\n\r\nNote: I don't think this code is very usable. I think I would want `ClassVar` here (or just a module-scoped variable), but thought the report might be interesting all the same.\r\n\r\n**Traceback**\r\n\r\nTraceback on current master:\r\n\r\n```https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build\r\nPlease report a bug at https://github.com/python/mypy/issues\r\nversion: 0.820+dev.88dde657fedecf17e15222ad4b685b0aeddcc423\r\nTraceback (most recent call last):\r\n  File \"/home/mjh/.pyenv/versions/3.8.6/bin/mypy\", line 33, in \u003cmodule>\r\n    sys.exit(load_entry_point('mypy', 'console_scripts', 'mypy')())\r\n  File \"/home/mjh/src/mypy/mypy/__main__.py\", line 11, in console_entry\r\n    main(None, sys.stdout, sys.stderr)\r\n  File \"/home/mjh/src/mypy/mypy/main.py\", line 98, in main\r\n    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)\r\n  File \"/home/mjh/src/mypy/mypy/build.py\", line 179, in build\r\n    result = _build(\r\n  File \"/home/mjh/src/mypy/mypy/build.py\", line 253, in _build\r\n    graph = dispatch(sources, manager, stdout)\r\n  File \"/home/mjh/src/mypy/mypy/build.py\", line 2658, in dispatch\r\n    process_graph(graph, manager)\r\n  File \"/home/mjh/src/mypy/mypy/build.py\", line 2982, in process_graph\r\n    process_stale_scc(graph, scc, manager)\r\n  File \"/home/mjh/src/mypy/mypy/build.py\", line 3074, in process_stale_scc\r\n    mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)\r\n  File \"/home/mjh/src/mypy/mypy/semanal_main.py\", line 78, in semantic_analysis_for_scc\r\n    process_top_levels(graph, scc, patches)\r\n  File \"/home/mjh/src/mypy/mypy/semanal_main.py\", line 199, in process_top_levels\r\n    deferred, incomplete, progress = semantic_analyze_target(next_id, state,\r\n  File \"/home/mjh/src/mypy/mypy/semanal_main.py\", line 326, in semantic_analyze_target\r\n    analyzer.refresh_partial(refresh_node,\r\n  File \"/home/mjh/src/mypy/mypy/semanal.py\", line 394, in refresh_partial\r\n    self.refresh_top_level(node)\r\n  File \"/home/mjh/src/mypy/mypy/semanal.py\", line 405, in refresh_top_level\r\n    self.accept(d)\r\n  File \"/home/mjh/src/mypy/mypy/semanal.py\", line 4835, in accept\r\n    node.accept(self)\r\n  File \"/home/mjh/src/mypy/mypy/nodes.py\", line 950, in accept\r\n    return visitor.visit_class_def(self)\r\n  File \"/home/mjh/src/mypy/mypy/semanal.py\", line 1048, in visit_class_def\r\n    self.analyze_class(defn)\r\n  File \"/home/mjh/src/mypy/mypy/semanal.py\", line 1125, in analyze_class\r\n    self.analyze_class_body_common(defn)\r\n  File \"/home/mjh/src/mypy/mypy/semanal.py\", line 1134, in analyze_class_body_common\r\n    self.apply_class_plugin_hooks(defn)\r\n  File \"/home/mjh/src/mypy/mypy/semanal.py\", line 1180, in apply_class_plugin_hooks\r\n    hook(ClassDefContext(defn, decorator, self))\r\n  File \"/home/mjh/src/mypy/mypy/plugins/dataclasses.py\", line 361, in dataclass_class_maker_callback\r\n    transformer.transform()\r\n  File \"/home/mjh/src/mypy/mypy/plugins/dataclasses.py\", line 106, in transform\r\n    ctx.api.defer()\r\n  File \"/home/mjh/src/mypy/mypy/semanal.py\", line 4554, in defer\r\n    assert not self.final_iteration, 'Must not defer during final iteration'\r\nAssertionError: Must not defer during final iteration\r\n/home/mjh/tmp/testing_py/mypy_test.py:9: : note: use --pdb to drop into pdb\r\n```\r\n\r\nTraceback on pip package:\r\n\r\n```\r\nmypy_test.py:9: error: INTERNAL ERROR -- Please try using mypy master on Github:\r\nhttps://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build\r\nPlease report a bug at https://github.com/python/mypy/issues\r\nversion: 0.800\r\nTraceback (most recent call last):\r\n  File \"mypy/semanal.py\", line 4835, in accept\r\n  File \"mypy/nodes.py\", line 950, in accept\r\n  File \"mypy/semanal.py\", line 1048, in visit_class_def\r\n  File \"mypy/semanal.py\", line 1125, in analyze_class\r\n  File \"mypy/semanal.py\", line 1134, in analyze_class_body_common\r\n  File \"mypy/semanal.py\", line 1180, in apply_class_plugin_hooks\r\n  File \"mypy/plugins/dataclasses.py\", line 361, in dataclass_class_maker_callback\r\n  File \"mypy/plugins/dataclasses.py\", line 106, in transform\r\n  File \"mypy/semanal.py\", line 4554, in defer\r\nAssertionError: Must not defer during final iteration\r\nmypy_test.py:9: : note: use --pdb to drop into pdb\r\n```\r\n\r\n**To Reproduce**\r\n\r\nRun `mypy` over a file containing the content above.\r\n\r\n**Your Environment**\r\n\r\n\u003c!-- Include as many relevant details about the environment you experienced the bug in -->\r\n\r\n- Mypy version used: 0.820+dev.88dde657fedecf17e15222ad4b685b0aeddcc423 and 0.800\r\n- Mypy command-line flags: None\r\n- Mypy configuration options from `mypy.ini` (and other config files): None\r\n- Python version used: 3.8.6\r\n- Operating system and version: Debian GNU/Linux 10 (buster)\r\n\r\n\u003c!--\r\nYou can freely edit this text, please remove all the lines\r\nyou believe are unnecessary.\r\n-->\r\n","author":{"url":"https://github.com/matthewhughes934","@type":"Person","name":"matthewhughes934"},"datePublished":"2021-02-13T17:12:34Z","url":"https://github.com/python/mypy/issues/10090"}

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:5c2db8ea-4fd0-d332-06ee-75b1e6a7abdf
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEC52:3E1398:26AFA2:344236:6B00240B
html-safe-nonce654267062818992d9e2858f5e9113ec4751b64faa0f84c25f1930e072094d906
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzUyOjNFMTM5ODoyNkFGQTI6MzQ0MjM2OjZCMDAyNDBCIiwidmlzaXRvcl9pZCI6IjM4OTk0OTU2NzI3NzYyMzgwOTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac6642c215480fd6fc5d8f7a41a7e5c869f4e0c848333cd795aa43cbc2ed4b4efb
hovercard-subject-tagissue:807788070
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/10090/issue_layout
twitter:imagehttps://opengraph.githubassets.com/90e318c60c1055e533f08a18dfc874169bae65c4da94f5801cdb6a447baae120/python/mypy/issues/10090
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/90e318c60c1055e533f08a18dfc874169bae65c4da94f5801cdb6a447baae120/python/mypy/issues/10090
og:image:altCrash Report I was just trying things out and found a crash with: from dataclasses import dataclass from typing import Final @dataclass class FirstClass: FIRST_CONST: Final = 3 @dataclass # mypy ru...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamematthewhughes934
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-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/10090#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F10090
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%2F10090
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/10090
Reloadhttps://github.com/python/mypy/issues/10090
Reloadhttps://github.com/python/mypy/issues/10090
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 requests546 (546)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/10090
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/10090
#13528https://github.com/python/mypy/pull/13528
Several dataclass crashes involving Final attributeshttps://github.com/python/mypy/issues/10090#top
#13528https://github.com/python/mypy/pull/13528
crashhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22crash%22
priority-0-highhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-0-high%22
topic-dataclasseshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-dataclasses%22
topic-finalPEP 591https://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-final%22
https://github.com/matthewhughes934
matthewhughes934https://github.com/matthewhughes934
on Feb 13, 2021https://github.com/python/mypy/issues/10090#issue-807788070
matthewhughes934https://github.com/matthewhughes934
crashhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22crash%22
on Feb 13, 2021https://github.com/python/mypy/issues/10090#event-4327956288
https://github.com/sisp
sisphttps://github.com/sisp
on Jun 22, 2021https://github.com/python/mypy/issues/10090#issuecomment-865971891
https://github.com/sisp
sisphttps://github.com/sisp
on Jun 23, 2021https://github.com/python/mypy/issues/10090#issuecomment-866686096
hauntsaninjahttps://github.com/hauntsaninja
on Sep 6, 2021https://github.com/python/mypy/issues/10090#event-5262473249
https://github.com/SyntaxColoring
SyntaxColoringhttps://github.com/SyntaxColoring
on Dec 4, 2021https://github.com/python/mypy/issues/10090#issuecomment-985967286
97littleleaf11https://github.com/97littleleaf11
priority-0-highhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-0-high%22
on Dec 20, 2021https://github.com/python/mypy/issues/10090#event-5790834994
WizzyGeekhttps://github.com/WizzyGeek
on Feb 15, 2022https://github.com/python/mypy/issues/10090#event-6074298460
[↩️] Workaround python/mypy#10090https://github.com/BytesToBits/Cordy/commit/fbcdadbad53d989ed8c8dbd81ed6870cb05fcdf6
python/mypy#10090https://github.com/python/mypy/issues/10090
fbcdadbhttps://github.com/BytesToBits/Cordy/commit/fbcdadbad53d989ed8c8dbd81ed6870cb05fcdf6
JelleZijlstrahttps://github.com/JelleZijlstra
topic-dataclasseshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-dataclasses%22
on Mar 19, 2022https://github.com/python/mypy/issues/10090#event-6270240750
AlexWaygoodhttps://github.com/AlexWaygood
topic-finalPEP 591https://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-final%22
on Mar 24, 2022https://github.com/python/mypy/issues/10090#event-6300103441
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
on May 18, 2022https://github.com/python/mypy/issues/10090#issuecomment-1130175070
#12762https://github.com/python/mypy/pull/12762
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
on Aug 11, 2022https://github.com/python/mypy/issues/10090#issuecomment-1211652291
@DetachHeadhttps://github.com/DetachHead
#13377https://github.com/python/mypy/issues/13377
ilevkivskyihttps://github.com/ilevkivskyi
completedhttps://github.com/python/mypy/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#13528https://github.com/python/mypy/pull/13528
on Aug 27, 2022https://github.com/python/mypy/issues/10090#event-7271239864
ilevkivskyihttps://github.com/ilevkivskyi
on Aug 27, 2022https://github.com/python/mypy/issues/10090#event-7271240154
Fix crash on bare Final in dataclass (#13528)https://github.com/python/mypy/commit/a9bc366ae501ccced78a2746b6eac07b93d7b15e
#13528https://github.com/python/mypy/pull/13528
https://docs.github.com/articles/closing-issues-via-commit-messages
a9bc366https://github.com/python/mypy/commit/a9bc366ae501ccced78a2746b6eac07b93d7b15e
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/10090
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/10090
crashhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22crash%22
priority-0-highhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-0-high%22
topic-dataclasseshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-dataclasses%22
topic-finalPEP 591https://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-final%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.