Title: `type: ignore` command not recognized after other comment · Issue #19366 · python/mypy · GitHub
Open Graph Title: `type: ignore` command not recognized after other comment · Issue #19366 · python/mypy
X Title: `type: ignore` command not recognized after other comment · Issue #19366 · python/mypy
Description: Bug Report mypy isn't recognizing type: ignore if it is after some other comment, e.g.: tree1.compare_structural_equality(None) # pyright: ignore[reportArgumentType] # type: ignore[arg-type] To Reproduce method strcuture (copied): (metho...
Open Graph Description: Bug Report mypy isn't recognizing type: ignore if it is after some other comment, e.g.: tree1.compare_structural_equality(None) # pyright: ignore[reportArgumentType] # type: ignore[arg-type] To Rep...
X Description: Bug Report mypy isn't recognizing type: ignore if it is after some other comment, e.g.: tree1.compare_structural_equality(None) # pyright: ignore[reportArgumentType] # type: ignore[arg-type] To...
Opengraph URL: https://github.com/python/mypy/issues/19366
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`type: ignore` command not recognized after other comment","articleBody":"**Bug Report**\n\nmypy isn't recognizing `type: ignore` if it is after some other comment, e.g.:\n\n```py\ntree1.compare_structural_equality(None) # pyright: ignore[reportArgumentType] # type: ignore[arg-type]\n```\n\n**To Reproduce**\n\nmethod strcuture (copied):\n\n```\n(method) def compare_structural_equality(\n obj: Tree,\n message_object: MessageObject = MessageObject(\"\")\n) -> bool\nCompare the structure of this tree with another tree.\n\nArgs\nobj : Tree\nThe tree to compare with.\n\nmessage_object : MessageObject\nObject to store messages about differences.\n\nReturns\nbool\nTrue if structures are equal, False otherwise.\n```\n\n```py\ntree1.compare_structural_equality(None) # type: ignore[arg-type] # pyright: ignore[reportArgumentType]\n```\n\n=> works 👍 \n\n```py\ntree1.compare_structural_equality(None) # pyright: ignore[reportArgumentType] # type: ignore[arg-type]\n```\n\n=> doesn't works 🤷 \n\n**Expected Behavior**\n\nBove examples work\n\n**Actual Behavior**\n\nOnly the first example works\n\n\u003c!-- What went wrong? Paste mypy's output. -->\n\n**Your Environment**\n\n\u003c!-- Include as many relevant details about the environment you experienced the bug in -->\n\n- Mypy version used: `mypy 1.16.1 (compiled: yes)`\n- Mypy command-line flags: `none`\n- Mypy configuration options from `mypy.ini` (and other config files): from `pyproject.toml`\n```toml\n[tool.mypy]\npython_version = \"3.12\"\nignore_missing_imports = true\nstrict = true\nshow_error_codes = true\n```\n- Python version used: `Python 3.12.0`\n\nI am sorry If I missed an explanation for this. I also don't know if it is appropriate to use mypy and pyright.\n\nIn my opinion both examples should work.\n","author":{"url":"https://github.com/paulchen5","@type":"Person","name":"paulchen5"},"datePublished":"2025-07-01T09:57:46Z","url":"https://github.com/python/mypy/issues/19366"}
| 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:e3c3e068-fc88-ab24-34c2-fba925d97ee8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C386:B5253:244EE2F:3048427:6B005A0D |
| html-safe-nonce | 92b4deee64a88dd4285921040cc0a3705e51ef8ba779a37b91eafed125df9250 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzg2OkI1MjUzOjI0NEVFMkY6MzA0ODQyNzo2QjAwNUEwRCIsInZpc2l0b3JfaWQiOiIxNjQzNzEyMjcyNjI4OTk2NjIxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a0c501d7d6eef14415019766d11f9d73c0be5f5932ad6a5a01293a7fcd713c36 |
| hovercard-subject-tag | issue:3191718986 |
| 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/19366/issue_layout |
| twitter:image | https://opengraph.githubassets.com/85ff1b9f8aa2a5cd194d6ff2ce479deeee02c6f1fb7d75206e358b5669000633/python/mypy/issues/19366 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/85ff1b9f8aa2a5cd194d6ff2ce479deeee02c6f1fb7d75206e358b5669000633/python/mypy/issues/19366 |
| og:image:alt | Bug Report mypy isn't recognizing type: ignore if it is after some other comment, e.g.: tree1.compare_structural_equality(None) # pyright: ignore[reportArgumentType] # type: ignore[arg-type] To Rep... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | paulchen5 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73 |
| 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 | eacd927ba6112e3b01ba99c762bd699a4a4f5df7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width