Title: Mypy 1.11.0 crashes on typing.NotRequired with `--html-report` · Issue #17604 · python/mypy · GitHub
Open Graph Title: Mypy 1.11.0 crashes on typing.NotRequired with `--html-report` · Issue #17604 · python/mypy
X Title: Mypy 1.11.0 crashes on typing.NotRequired with `--html-report` · Issue #17604 · python/mypy
Description: Crash Report Mypy crashes on a Python file that makes use of typing.NotRequired when used with the --html-report option. Traceback To Reproduce I took an example from the typing docs on TypedDict: from typing import NotRequired, TypedDic...
Open Graph Description: Crash Report Mypy crashes on a Python file that makes use of typing.NotRequired when used with the --html-report option. Traceback To Reproduce I took an example from the typing docs on TypedDict: ...
X Description: Crash Report Mypy crashes on a Python file that makes use of typing.NotRequired when used with the --html-report option. Traceback To Reproduce I took an example from the typing docs on TypedDict: ...
Opengraph URL: https://github.com/python/mypy/issues/17604
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Mypy 1.11.0 crashes on typing.NotRequired with `--html-report`","articleBody":"\u003c!--\r\n Use this form only if mypy reports an \"INTERNAL ERROR\" and/or gives a traceback.\r\n Please include the traceback and all other messages below (use `mypy --show-traceback`).\r\n-->\r\n\r\n**Crash Report**\r\n\r\nMypy crashes on a Python file that makes use of `typing.NotRequired` when used with the `--html-report` option.\r\n\r\n**Traceback**\r\n\r\n\r\n\r\n**To Reproduce**\r\n\r\nI took an example from the `typing` docs on `TypedDict`:\r\n\r\n```python\r\nfrom typing import NotRequired, TypedDict\r\n\r\n\r\nclass Point2D(TypedDict):\r\n x: int\r\n y: int\r\n label: NotRequired[str]\r\n```\r\n\r\nRunning mypy on it with `--html-report` causes a crash:\r\n\r\n```console\r\n(sandbox-312) sander@bedevere:~/documents/projects/python-sandbox$ mypy --html-report mypy --show-traceback reproduce.py\r\nreproduce.py: 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 \"/home/sander/.virtualenvs/sandbox-312/bin/mypy\", line 8, in \u003cmodule>\r\n sys.exit(console_entry())\r\n File \"mypy/build.py\", line 2069, in wrap_context\r\nTypeError: mypy.types.ProperType object expected; got mypy.types.RequiredType\r\nreproduce.py: : note: use --pdb to drop into pdb\r\nGenerated HTML report (via XSLT): /home/sander/documents/projects/python-sandbox/mypy/index.html\r\n(sandbox-312) sander@bedevere:~/documents/projects/python-sandbox$ cat mypy/index.html\r\n\u003chtml>\r\n\u003chead>\r\n\u003cmeta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n\u003clink rel=\"stylesheet\" type=\"text/css\" href=\"mypy-html.css\">\r\n\u003c/head>\r\n\u003cbody>\r\n\u003ch1>Mypy Type Check Coverage Summary\u003c/h1>\r\n\u003ctable class=\"summary\">\r\n\u003ccaption>Summary from index\u003c/caption>\r\n\u003cthead>\u003ctr class=\"summary\">\r\n\u003cth class=\"summary\">File\u003c/th>\r\n\u003cth class=\"summary\">Imprecision\u003c/th>\r\n\u003cth class=\"summary\">Lines\u003c/th>\r\n\u003c/tr>\u003c/thead>\r\n\u003ctfoot>\u003ctr class=\"summary summary-quality-0\">\r\n\u003cth class=\"summary summary-filename\">Total\u003c/th>\r\n\u003cth class=\"summary summary-precision\">0.00% imprecise\u003c/th>\r\n\u003cth class=\"summary summary-lines\">0 LOC\u003c/th>\r\n\u003c/tr>\u003c/tfoot>\r\n\u003ctbody>\u003c/tbody>\r\n\u003c/table>\r\n\u003c/body>\r\n\u003c/html>\r\n(sandbox-312) sander@bedevere:~/documents/projects/python-sandbox$ mypy --version\r\nmypy 1.11.0 (compiled: yes)\r\n```\r\n\r\nWhen I change the `NotRequired[str]` to plain `str`, mypy succeeds. The issue also doesn't occur without the `--html-report` option.\r\n\r\nI failed to reproduce the issue from a source installation, even from a checked out `v1.11.0` tag. But I get it consistently with the 1.11.0 version published to PyPi.\r\n\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.0 (from PyPi, could not reproduce from source installation, even from checked out v1.11.0 tag)\r\n- Mypy command-line flags: `--html-report mypy --show-traceback reproduce.py`\r\n- Mypy configuration options from `mypy.ini` (and other config files): none\r\n- Python version used: 3.11 and 3.12\r\n- Operating system and version: Arch Linux\r\n","author":{"url":"https://github.com/sanderr","@type":"Person","name":"sanderr"},"datePublished":"2024-07-30T09:48:09Z","url":"https://github.com/python/mypy/issues/17604"}
| 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:afc165b9-8528-7ecc-e664-42acce3f0767 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CC72:1A12A9:E227A2:12E5F60:6B005760 |
| html-safe-nonce | c71e221f7f25546f1da47d6342b9dfe70acc05b8df7f92761fa3e282c7f7e6a7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzcyOjFBMTJBOTpFMjI3QTI6MTJFNUY2MDo2QjAwNTc2MCIsInZpc2l0b3JfaWQiOiI1NzA1ODE0NTgwODAyOTAxODU2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 47423316b39a886a84172d37588ab7ac11041fccb4ae069e7dcb8193b24323a1 |
| hovercard-subject-tag | issue:2437401427 |
| 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/17604/issue_layout |
| twitter:image | https://opengraph.githubassets.com/09fcff5a380e15091a753a3ff48dd32e36bfcbbabd8ee4cde50fcf1b542d9764/python/mypy/issues/17604 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/09fcff5a380e15091a753a3ff48dd32e36bfcbbabd8ee4cde50fcf1b542d9764/python/mypy/issues/17604 |
| og:image:alt | Crash Report Mypy crashes on a Python file that makes use of typing.NotRequired when used with the --html-report option. Traceback To Reproduce I took an example from the typing docs on TypedDict: ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sanderr |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| 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 | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width