René's URL Explorer Experiment


Title: segfault on recursive type · Issue #6730 · python/mypy · GitHub

Open Graph Title: segfault on recursive type · Issue #6730 · python/mypy

X Title: segfault on recursive type · Issue #6730 · python/mypy

Description: I'm running mypy 0.701 on Python 3.7.2 on Linux, with the following input: from typing import Any, Generic, Iterable, TypeVar, Union ValueT = TypeVar('ValueT') class Recursive(Iterable[Union[ValueT, 'Recursive[ValueT]']]): pass class Bas...

Open Graph Description: I'm running mypy 0.701 on Python 3.7.2 on Linux, with the following input: from typing import Any, Generic, Iterable, TypeVar, Union ValueT = TypeVar('ValueT') class Recursive(Iterable[Union[ValueT...

X Description: I'm running mypy 0.701 on Python 3.7.2 on Linux, with the following input: from typing import Any, Generic, Iterable, TypeVar, Union ValueT = TypeVar('ValueT') class Recursive(Iterable[...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"segfault on recursive type","articleBody":"I'm running mypy 0.701 on Python 3.7.2 on Linux, with the following input:\r\n```py\r\nfrom typing import Any, Generic, Iterable, TypeVar, Union\r\n\r\nValueT = TypeVar('ValueT')\r\n\r\nclass Recursive(Iterable[Union[ValueT, 'Recursive[ValueT]']]):\r\n    pass\r\n\r\nclass Base(Generic[ValueT]):\r\n    def __init__(self, element: ValueT):\r\n        pass\r\n\r\nclass Sub(Base[Union[ValueT, Recursive[ValueT]]]):\r\n    pass\r\n\r\nx: Iterable[str]\r\nprint(Sub(x))\r\n```\r\nI ran mypy under gdb to get a stack trace, but the stack trace is over 70,000 frames long (the point at which I aborted its listing), so I don't think including the full thing would be feasible or useful.\r\n\r\nIt looks like the following pattern is repeated over and over:\r\n```\r\n#70084 0x00007ffff5f0d32f in CPyDef_types_accept_Instance (cpy_r_self=0x0, cpy_r_visitor=\u003coptimized out>) at build/__native.c:1601677\r\n#70085 0x00007ffff5db4b84 in CPyDef_subtypes_is_proper_subtype (cpy_r_left=0x7fffe766a6d8, cpy_r_right=\u003coptimized out>, cpy_r_ignore_promotions=\u003coptimized out>) at build/__native.c:1474319\r\n#70086 0x00007ffff5d79820 in CPyDef_types_make_simplified_union_UnionType (cpy_r_items=\u003coptimized out>, cpy_r_line=\u003coptimized out>, cpy_r_column=\u003coptimized out>) at build/__native.c:1626562\r\n#70087 0x00007ffff5f26ccd in CPyDef_expandtype_visit_union_type_ExpandTypeVisitor (cpy_r_self=\u003coptimized out>, cpy_r_t=0x7fffe8294f48) at build/__native.c:388697\r\n#70088 0x00007ffff5f26e06 in CPyDef_expandtype_visit_union_type__TypeVisitor_glue_ExpandTypeVisitor (cpy_r_self=0x8af200 \u003cPyDict_Type>, cpy_r_t=0x7ffff6ccec00) at build/__native.c:388750\r\n#70089 0x00007ffff65bac5f in CPyDef_types_accept_UnionType (cpy_r_self=0x0, cpy_r_visitor=\u003coptimized out>) at build/__native.c:1626978\r\n#70090 0x00007ffff5f24be7 in CPyDef_expandtype_expand_types_ExpandTypeVisitor (cpy_r_self=0x7fffe76e5870, cpy_r_types=\u003coptimized out>) at build/__native.c:389037\r\n#70091 0x00007ffff5f2481f in CPyDef_expandtype_visit_instance_ExpandTypeVisitor (cpy_r_self=0x7fffe76e5870, cpy_r_t=0x7fffe7d5cf28) at build/__native.c:387615\r\n#70092 0x00007ffff5f24e36 in CPyDef_expandtype_visit_instance__TypeVisitor_glue_ExpandTypeVisitor (cpy_r_self=0x8af200 \u003cPyDict_Type>, cpy_r_t=0x7ffff6ccec00) at build/__native.c:387706\r\n#70093 0x00007ffff5f0d32f in CPyDef_types_accept_Instance (cpy_r_self=0x0, cpy_r_visitor=\u003coptimized out>) at build/__native.c:1601677\r\n#70094 0x00007ffff5c4ef15 in CPyDef_expandtype_expand_type (cpy_r_typ=0x7fffe7d5cf28, cpy_r_env=0x7fffe76e5828) at build/__native.c:386276\r\n#70095 0x00007ffff5ff068b in CPyDef_maptype_map_instance_to_direct_supertypes (cpy_r_instance=0x7fffe766a588, cpy_r_supertype=0x7fffe858b258) at build/__native.c:519519\r\n#70096 0x00007ffff5fef535 in CPyDef_maptype_map_instance_to_supertypes (cpy_r_instance=\u003coptimized out>, cpy_r_supertype=\u003coptimized out>) at build/__native.c:518873\r\n#70097 0x00007ffff5d9d105 in CPyDef_maptype_map_instance_to_supertype (cpy_r_instance=0x7fffe766a588, cpy_r_superclass=0x7fffe858b258) at build/__native.c:518619\r\n#70098 0x00007ffff6509a9c in CPyDef_subtypes_visit_instance_ProperSubtypeVisitor (cpy_r_self=\u003coptimized out>, cpy_r_left=\u003coptimized out>) at build/__native.c:1475884\r\n#70099 0x00007ffff650aff6 in CPyDef_subtypes_visit_instance__TypeVisitor_glue_ProperSubtypeVisitor (cpy_r_self=0x8af200 \u003cPyDict_Type>, cpy_r_t=0x7ffff6ccec00) at build/__native.c:1476491\r\n```\r\n\r\nI guess the compiled part of mypy got into an infinite recursion trying to figure out the recursive type definition and eventually hit a system limit on the native stack size.","author":{"url":"https://github.com/mthuurne","@type":"Person","name":"mthuurne"},"datePublished":"2019-04-27T02:01:11Z","url":"https://github.com/python/mypy/issues/6730"}

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:aaf46e37-ea4f-46f1-314f-be51418d0403
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8886:2B9B04:288067E:352275C:6B000A5D
html-safe-nonce5fe7fc9ec3b7cef2821a3987e39f930267661b20dbca792e11ca5de76cffedbc
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODg2OjJCOUIwNDoyODgwNjdFOjM1MjI3NUM6NkIwMDBBNUQiLCJ2aXNpdG9yX2lkIjoiNzA3NTc5MDQ2MTEwMDYyNDQ3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac7b529da32cf0c259742e5994f3ec8455f405ebbd34429ca6858ccad8ec3c3e99
hovercard-subject-tagissue:437894675
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/6730/issue_layout
twitter:imagehttps://opengraph.githubassets.com/45cf467a431e272ea27d12bb3b528d5cc1656f68e4765af85a466082a51d2b6e/python/mypy/issues/6730
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/45cf467a431e272ea27d12bb3b528d5cc1656f68e4765af85a466082a51d2b6e/python/mypy/issues/6730
og:image:altI'm running mypy 0.701 on Python 3.7.2 on Linux, with the following input: from typing import Any, Generic, Iterable, TypeVar, Union ValueT = TypeVar('ValueT') class Recursive(Iterable[Union[ValueT...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemthuurne
hostnamegithub.com
expected-hostnamegithub.com
None0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729
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
release16a11879678aaf97e2a42c33ee70830aa084fa37
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/6730#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F6730
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%2F6730
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/6730
Reloadhttps://github.com/python/mypy/issues/6730
Reloadhttps://github.com/python/mypy/issues/6730
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/6730
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/6730
#14178https://github.com/python/mypy/pull/14178
segfault on recursive typehttps://github.com/python/mypy/issues/6730#top
#14178https://github.com/python/mypy/pull/14178
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-recursive-typeshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-recursive-types%22
topic-type-variableshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-type-variables%22
topic-union-typeshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-union-types%22
https://github.com/mthuurne
mthuurnehttps://github.com/mthuurne
on Apr 27, 2019https://github.com/python/mypy/issues/6730#issue-437894675
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Apr 27, 2019https://github.com/python/mypy/issues/6730#issuecomment-487301744
ilevkivskyihttps://github.com/ilevkivskyi
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-type-variableshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-type-variables%22
topic-union-typeshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-union-types%22
on Apr 27, 2019https://github.com/python/mypy/issues/6730#event-2304825549
https://github.com/JukkaL
JukkaLhttps://github.com/JukkaL
on Feb 14, 2020https://github.com/python/mypy/issues/6730#issuecomment-586352685
https://github.com/TH3CHARLie
TH3CHARLiehttps://github.com/TH3CHARLie
on Feb 14, 2020https://github.com/python/mypy/issues/6730#issuecomment-586451390
https://github.com/bluetech
bluetechhttps://github.com/bluetech
on Mar 29, 2020https://github.com/python/mypy/issues/6730#issuecomment-605612495
https://github.com/A5rocks
A5rockshttps://github.com/A5rocks
on Aug 16, 2020https://github.com/python/mypy/issues/6730#issuecomment-674462978
AlexWaygoodhttps://github.com/AlexWaygood
topic-recursive-typeshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-recursive-types%22
on Mar 27, 2022https://github.com/python/mypy/issues/6730#event-6313802827
ilevkivskyihttps://github.com/ilevkivskyi
completedhttps://github.com/python/mypy/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#14178https://github.com/python/mypy/pull/14178
on Nov 24, 2022https://github.com/python/mypy/issues/6730#event-7887605466
ilevkivskyihttps://github.com/ilevkivskyi
on Nov 24, 2022https://github.com/python/mypy/issues/6730#event-7887605600
Proposal: don't simplify unions in expand_type() (#14178)https://github.com/python/mypy/commit/4471c7e76f27ee51eb8d47a4803097ec15c62128
#14178https://github.com/python/mypy/pull/14178
https://docs.github.com/articles/closing-issues-via-commit-messages
4471c7ehttps://github.com/python/mypy/commit/4471c7e76f27ee51eb8d47a4803097ec15c62128
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/6730
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/6730
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-recursive-typeshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-recursive-types%22
topic-type-variableshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-type-variables%22
topic-union-typeshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-union-types%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.