Title: Show relative error location for function aliases · Issue #20640 · python/mypy · GitHub
Open Graph Title: Show relative error location for function aliases · Issue #20640 · python/mypy
X Title: Show relative error location for function aliases · Issue #20640 · python/mypy
Description: This is a follow-up for #20635 Currently we do not serialize .definition of a CallableType and instead set it in fixup.py if the type appears as a type of a function. This is because there is a reference cycle definition <-> type, and ha...
Open Graph Description: This is a follow-up for #20635 Currently we do not serialize .definition of a CallableType and instead set it in fixup.py if the type appears as a type of a function. This is because there is a ref...
X Description: This is a follow-up for #20635 Currently we do not serialize .definition of a CallableType and instead set it in fixup.py if the type appears as a type of a function. This is because there is a ref...
Opengraph URL: https://github.com/python/mypy/issues/20640
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Show relative error location for function aliases","articleBody":"This is a follow-up for https://github.com/python/mypy/pull/20635\n\nCurrently we do not serialize `.definition` of a `CallableType` and instead set it in fixup.py if the type appears as a type of a function. This is because there is a reference cycle definition \u003c-> type, and handling it \"properly\" would require some complications similar to e.g. `Instance` \u003c-> `TypeInfo`. However, the current logic causes inconsistencies in error reporting in relative locations. For example, this test fails on second run.\n```\n[case testCachedUnexpectedKeywordArgumentAlias]\nimport a\n[file a.py]\nimport b\nb.lol2(uhhhh=12) # tweak\n[file a.py.2]\nimport b\nb.lol2(uhhhh=12)\n[file b.py]\ndef lol() -> None: pass\nlol2 = lol\n[out]\ntmp/a.py:2: error: Unexpected keyword argument \"uhhhh\"\ntmp/b.py:1: note: Called function defined here\n[out2]\ntmp/a.py:2: error: Unexpected keyword argument \"uhhhh\"\ntmp/b.py:1: note: Called function defined here\n```\nSame problem also affects our `partial` plugin. We should either handle `.definition` \"properly\" (which may be a big change), or just erase it when aliasing `CallableType`s (which will make errors potentially less helpful).","author":{"url":"https://github.com/ilevkivskyi","@type":"Person","name":"ilevkivskyi"},"datePublished":"2026-01-23T12:58:16Z","url":"https://github.com/python/mypy/issues/20640"}
| 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:ddae1879-6bff-f9be-bff1-b1ee3c9e8ce3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EC88:34D7A7:248CC5:31738A:6B002410 |
| html-safe-nonce | 3ccb1293cee071ab7113b0102bcce602a6b272f06e65e12be999880fb854ce9c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzg4OjM0RDdBNzoyNDhDQzU6MzE3MzhBOjZCMDAyNDEwIiwidmlzaXRvcl9pZCI6IjU0OTY4NzM3MTA4NDM0MjI4OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c9fa8d1c0e2e951eb48ee41048a2a1aa8e43380b6fd7bd9188637092afdf5064 |
| hovercard-subject-tag | issue:3847348163 |
| 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/20640/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c76b7256968e7d4442923b0721664f8c43c19dbd52bca26555b8e79e048aff89/python/mypy/issues/20640 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c76b7256968e7d4442923b0721664f8c43c19dbd52bca26555b8e79e048aff89/python/mypy/issues/20640 |
| og:image:alt | This is a follow-up for #20635 Currently we do not serialize .definition of a CallableType and instead set it in fixup.py if the type appears as a type of a function. This is because there is a ref... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ilevkivskyi |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width