Title: [2.4 regression] type-ignore comments with mixed type-checker rule names broken · Issue #22085 · python/mypy · GitHub
Open Graph Title: [2.4 regression] type-ignore comments with mixed type-checker rule names broken · Issue #22085 · python/mypy
X Title: [2.4 regression] type-ignore comments with mixed type-checker rule names broken · Issue #22085 · python/mypy
Description: Bug Report With the recent upgrade to 2.4.0, most of the # type: ignore[...] comments in our project are broken. We're using both mypy and ty for type checking, so the error codes of both mypy and ty are included in the brackets of the t...
Open Graph Description: Bug Report With the recent upgrade to 2.4.0, most of the # type: ignore[...] comments in our project are broken. We're using both mypy and ty for type checking, so the error codes of both mypy and ...
X Description: Bug Report With the recent upgrade to 2.4.0, most of the # type: ignore[...] comments in our project are broken. We're using both mypy and ty for type checking, so the error codes of both mypy ...
Opengraph URL: https://github.com/python/mypy/issues/22085
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[2.4 regression] type-ignore comments with mixed type-checker rule names broken","articleBody":"**Bug Report**\n\nWith the recent upgrade to 2.4.0, most of the `# type: ignore[...]` comments in our project are broken.\n\nWe're using both `mypy` and `ty` for type checking, so the error codes of both mypy and ty are included in the brackets of the type-ignore comments, [with ty's error codes always using the `ty:` prefix](https://docs.astral.sh/ty/suppression/#standard-suppression-comments). This is now broken and mypy raises a \"syntax\" error.\n\n**To Reproduce**\n\nhttps://mypy-play.net/?mypy=master&python=3.14&flags=show-traceback&gist=66867153c54763217583db5d60b83a83\n\n```python\nfoo: int = \"bar\" # type: ignore[assignment, ty:invalid-assignment]\nbar: int = \"foo\" # type: ignore[assignment] # ty: ignore[invalid-assignment]\n```\n\n```\nmain.py:1: error: Incompatible types in assignment (expression has type \"str\", variable has type \"int\") [assignment]\nmain.py:1: error: Invalid \"type: ignore\" comment [syntax]\nFound 2 errors in 1 file (checked 1 source file)\n```\n\nmypy-play doesn't have the 2.4.0 option yet, but selecting master reproduces. Switching to 2.3.1 does not raise any errors, as expected.\n\n**Your Environment**\n\n- Mypy version used: 2.4.0\n- Mypy command-line flags:\n- Mypy configuration options from `mypy.ini` (and other config files):\n- Python version used: 3.14\n","author":{"url":"https://github.com/bastimeyer","@type":"Person","name":"bastimeyer"},"datePublished":"2026-10-02T13:45:10Z","url":"https://github.com/python/mypy/issues/22085"}
| 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:86720d88-266f-2c39-ffc1-97c1d9ab753e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 92D0:1F3799:2EC9D44:3DD3A60:6B002561 |
| html-safe-nonce | 2a71302f2af6d67e1b7827bc42688428752376ef1b78d8874f61a0d238075000 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MkQwOjFGMzc5OToyRUM5RDQ0OjNERDNBNjA6NkIwMDI1NjEiLCJ2aXNpdG9yX2lkIjoiNzkyMDM1OTgxODA5Nzg2MTk4NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c966e9af30e69d6b631989f9a354c81a0d759647b82ce569f5afef0c5cda82cf |
| hovercard-subject-tag | issue:5678302662 |
| 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/22085/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1deb123aa133a70d330c4e048dc3f0b54b45288a567c18aedeee2cbe436199f3/python/mypy/issues/22085 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1deb123aa133a70d330c4e048dc3f0b54b45288a567c18aedeee2cbe436199f3/python/mypy/issues/22085 |
| og:image:alt | Bug Report With the recent upgrade to 2.4.0, most of the # type: ignore[...] comments in our project are broken. We're using both mypy and ty for type checking, so the error codes of both mypy and ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bastimeyer |
| 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