Title: Crash with slices e.g. `Annotated[int, 3:4]` · Issue #10266 · python/mypy · GitHub
Open Graph Title: Crash with slices e.g. `Annotated[int, 3:4]` · Issue #10266 · python/mypy
X Title: Crash with slices e.g. `Annotated[int, 3:4]` · Issue #10266 · python/mypy
Description: Bug Report / To Reproduce / Actual Behavior This: # file.py from typing import Annotated def func(x: Annotated[int, 3:4]): pass # command line mypy file.py produces: file.py:4: error: syntax error in type comment Found 1 error in 1 file ...
Open Graph Description: Bug Report / To Reproduce / Actual Behavior This: # file.py from typing import Annotated def func(x: Annotated[int, 3:4]): pass # command line mypy file.py produces: file.py:4: error: syntax error ...
X Description: Bug Report / To Reproduce / Actual Behavior This: # file.py from typing import Annotated def func(x: Annotated[int, 3:4]): pass # command line mypy file.py produces: file.py:4: error: syntax error ...
Opengraph URL: https://github.com/python/mypy/issues/10266
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Crash with slices e.g. `Annotated[int, 3:4]`","articleBody":"**Bug Report / To Reproduce / Actual Behavior**\r\n\r\nThis:\r\n```python\r\n# file.py\r\nfrom typing import Annotated\r\ndef func(x: Annotated[int, 3:4]):\r\n pass\r\n\r\n# command line\r\nmypy file.py\r\n```\r\nproduces:\r\n```\r\nfile.py:4: error: syntax error in type comment\r\nFound 1 error in 1 file (errors prevented further checking)\r\n```\r\n\r\n**Your Environment**\r\n\r\n- Mypy version used: 0.812\r\n- Mypy command-line flags: None\r\n- Mypy configuration options from `mypy.ini` (and other config files): None\r\n- Python version used: 3.9.2\r\n- Operating system and version: Windows 10\r\n\r\n**Further details**\r\n\r\nAny use of slices seems to give the error, e.g. `Annotated[int, \"a\": 4]`.\r\n\r\nI actually ran into this whilst implementing a type with a custom `__class_getitem__`, using slice notation as a convenient notation to pass pairs of values: `MyType[\"key1\": value1, \"key2\": value2]`. Which I realise is a bit rogue -- I don't have any real hope of mypy integration for the type -- but it would at least be nice if it can be used without crashing mypy, with just a `# type: ignore` where it's imported.","author":{"url":"https://github.com/patrick-kidger","@type":"Person","name":"patrick-kidger"},"datePublished":"2021-03-30T17:19:12Z","url":"https://github.com/python/mypy/issues/10266"}
| 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:7ae1e71e-7940-5f7a-ff02-6a96b7e6f92c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C1DE:1F5A:D7B89:17EF5B:6B002D6D |
| html-safe-nonce | 8f51f431f0641f88b2c824f87dc43f419e96e7be326434bb2e116aaecaccef08 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMURFOjFGNUE6RDdCODk6MTdFRjVCOjZCMDAyRDZEIiwidmlzaXRvcl9pZCI6IjEwNTQzMzY1NDkzNzE1MjI0MTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c9b87718b625364e19f7da20fedbaabb16faf12072fa137f2cb5481dce7e826c |
| hovercard-subject-tag | issue:844918186 |
| 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/10266/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7742114fb14bd3e2a211d556da22077bbe404c2a2253a24baba880e163cdd5d3/python/mypy/issues/10266 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7742114fb14bd3e2a211d556da22077bbe404c2a2253a24baba880e163cdd5d3/python/mypy/issues/10266 |
| og:image:alt | Bug Report / To Reproduce / Actual Behavior This: # file.py from typing import Annotated def func(x: Annotated[int, 3:4]): pass # command line mypy file.py produces: file.py:4: error: syntax error ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | patrick-kidger |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width