René's URL Explorer Experiment


Title: Crash in version 1.11 lambda processing (regression since version 1.10) · Issue #17595 · python/mypy · GitHub

Open Graph Title: Crash in version 1.11 lambda processing (regression since version 1.10) · Issue #17595 · python/mypy

X Title: Crash in version 1.11 lambda processing (regression since version 1.10) · Issue #17595 · python/mypy

Description: Crash Report We maintain a large (1M+ LoC), proprietary Python code base, currently using mypy version 1.10. During an upgrade to version 1.11, I noticed some INTERNAL ERROR output so decided to investigate. Traceback bug.py:11: error: I...

Open Graph Description: Crash Report We maintain a large (1M+ LoC), proprietary Python code base, currently using mypy version 1.10. During an upgrade to version 1.11, I noticed some INTERNAL ERROR output so decided to in...

X Description: Crash Report We maintain a large (1M+ LoC), proprietary Python code base, currently using mypy version 1.10. During an upgrade to version 1.11, I noticed some INTERNAL ERROR output so decided to in...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Crash in version 1.11 lambda processing (regression since version 1.10)","articleBody":"**Crash Report**\r\n\r\nWe maintain a large (1M+ LoC), proprietary Python code base, currently using mypy version 1.10. During an upgrade to version 1.11, I noticed some INTERNAL ERROR output so decided to investigate.\r\n\r\n**Traceback**\r\n\r\n```\r\nbug.py:11: 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.11.0\r\nTraceback (most recent call last):\r\n  File \"mypy/checkexpr.py\", line 5830, in accept\r\n  File \"mypy/nodes.py\", line 2278, in accept\r\n  File \"mypy/checkexpr.py\", line 5294, in visit_lambda_expr\r\n  File \"/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py\", line 137, in __enter__\r\n    return next(self.gen)\r\n           ^^^^^^^^^^^^^^\r\n  File \"mypy/binder.py\", line 436, in frame_context\r\nAssertionError:\r\n```\r\n\r\n**To Reproduce**\r\n\r\nSince I am unable to provide our full source code, I created the following small stand-alone example:\r\n\r\n```\r\ndef foo(x):\r\n    pass\r\n\r\n\r\nclass Bar:\r\n    def baz(self, x):\r\n        pass\r\n\r\n\r\nclass Qux(Bar):\r\n    @foo(lambda x: None)\r\n    def baz(self, x) -> None:\r\n        pass\r\n```\r\n\r\nThe crash seems to occur when a method decorator defined with a lambda overrides another method of the same name in a base class _and_ there's an annotation mismatch.\r\n\r\nThat is, for the above example, the crash can be avoided by adding a return value annotation to `baz()` in the base class:\r\n\r\n```\r\n class Bar:\r\n-    def baz(self, x):\r\n+    def baz(self, x) -> None:\r\n         pass\r\n```\r\n\r\n**Investigation**\r\n\r\nI narrowed the regression down to the following commit (the crash is avoided if I revert this change):\r\n\r\nhttps://github.com/python/mypy/commit/5059ffdd5df4702ae5b690a6dfd5f1a70c7964e1\r\n\r\nThe crash can also be avoided if I adjust the assertion at the crash site:\r\n\r\n```\r\n--- binder.py.bak\t2024-07-26 10:54:02\r\n+++ binder.py\t2024-07-26 10:54:07\r\n@@ -433,7 +433,7 @@\r\n         whether any types changed in the newly-topmost frame as a result\r\n         of popping this frame.\r\n         \"\"\"\r\n-        assert len(self.frames) > 1\r\n+        assert len(self.frames) > 0\r\n\r\n         if break_frame:\r\n             self.break_frames.append(len(self.frames) - break_frame)\r\n```\r\n\r\n`pytest -q mypy` passes after this change, and a full run of mypy 1.11 on our large code base also succeeds without any tracebacks or obvious ill-effects, but I'm otherwise not familiar enough with the innards of mypy to have confidence in its correctness (hence I felt more comfortable providing the FYI here instead of submitting a PR).\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: 1.11\r\n- Mypy command-line flags: None (defaults)\r\n- Mypy configuration options from `mypy.ini` (and other config files): Reproduced with defaults\r\n- Python version used: 3.11.9\r\n- Operating system and version: macOS Sonoma 14.5\r\n\r\n","author":{"url":"https://github.com/acamatcisco","@type":"Person","name":"acamatcisco"},"datePublished":"2024-07-26T14:25:39Z","url":"https://github.com/python/mypy/issues/17595"}

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:6ee62afd-0982-4a0e-d28d-e6f2f7921a67
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCEF0:26206F:2C636BA:3A695AE:6B0018F3
html-safe-noncebf23c777fcafb3eab1b0beeaf101fa7b7b4144fa3102116493aafd6800cd9a2a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRUYwOjI2MjA2RjoyQzYzNkJBOjNBNjk1QUU6NkIwMDE4RjMiLCJ2aXNpdG9yX2lkIjoiNzk5MjM5MzA0MjQ5MTM0OTIzNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac30c6a5c4941fe75dcacd01089b80adfc70352b1dfb01bda8d2d197f8537c82a6
hovercard-subject-tagissue:2432359271
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/17595/issue_layout
twitter:imagehttps://opengraph.githubassets.com/aba214bd587852cfecca1685fd727c2083f850c97f0ae48f6b698e1948f2baf9/python/mypy/issues/17595
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/aba214bd587852cfecca1685fd727c2083f850c97f0ae48f6b698e1948f2baf9/python/mypy/issues/17595
og:image:altCrash Report We maintain a large (1M+ LoC), proprietary Python code base, currently using mypy version 1.10. During an upgrade to version 1.11, I noticed some INTERNAL ERROR output so decided to in...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameacamatcisco
hostnamegithub.com
expected-hostnamegithub.com
Nonea2dd2291b1b13cc9c06f27ec92fa3dbaf34116fc24c9347b8539db61884c59f4
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
release70121d4e855ee0bb7b75cf15d061d91f8863c0f8
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/17595#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F17595
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%2F17595
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/17595
Reloadhttps://github.com/python/mypy/issues/17595
Reloadhttps://github.com/python/mypy/issues/17595
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/17595
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/17595
#17643https://github.com/python/mypy/pull/17643
Crash in version 1.11 lambda processing (regression since version 1.10)https://github.com/python/mypy/issues/17595#top
#17643https://github.com/python/mypy/pull/17643
crashhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22crash%22
https://github.com/acamatcisco
acamatciscohttps://github.com/acamatcisco
on Jul 26, 2024https://github.com/python/mypy/issues/17595#issue-2432359271
5059ffdhttps://github.com/python/mypy/commit/5059ffdd5df4702ae5b690a6dfd5f1a70c7964e1
acamatciscohttps://github.com/acamatcisco
crashhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22crash%22
on Jul 26, 2024https://github.com/python/mypy/issues/17595#event-13662109450
acamatciscohttps://github.com/acamatcisco
on Jul 26, 2024https://github.com/python/mypy/issues/17595#event-13662113144
https://github.com/andersk
anderskhttps://github.com/andersk
on Jul 26, 2024https://github.com/python/mypy/issues/17595#issuecomment-2253231499
5059ffdhttps://github.com/python/mypy/commit/5059ffdd5df4702ae5b690a6dfd5f1a70c7964e1
b41bb66https://github.com/python/mypy/commit/b41bb66b066953ffb4d17eafcbb56057d08f63a5
#5637https://github.com/python/mypy/pull/5637
Playgroundhttps://mypy-play.net/?mypy=latest&python=3.12&gist=f6a23e5f03677b5b94784e13fd70b757
https://github.com/acamatcisco
acamatciscohttps://github.com/acamatcisco
on Jul 26, 2024https://github.com/python/mypy/issues/17595#issuecomment-2253364044
ilevkivskyihttps://github.com/ilevkivskyi
completedhttps://github.com/python/mypy/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#17643https://github.com/python/mypy/pull/17643
on Aug 4, 2024https://github.com/python/mypy/issues/17595#event-13755995978
ilevkivskyihttps://github.com/ilevkivskyi
on Aug 4, 2024https://github.com/python/mypy/issues/17595#event-13755995979
Always reset binder when checking deferred nodes (#17643)https://github.com/python/mypy/commit/50d0d047eb3dedf3b801c3731a37d56c320bad3e
#17643https://github.com/python/mypy/pull/17643
50d0d04https://github.com/python/mypy/commit/50d0d047eb3dedf3b801c3731a37d56c320bad3e
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/17595
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/17595
crashhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22crash%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.