Title: TypedDict as default_factory in dataclasses is not inferred correctly · Issue #5723 · python/mypy · GitHub
Open Graph Title: TypedDict as default_factory in dataclasses is not inferred correctly · Issue #5723 · python/mypy
X Title: TypedDict as default_factory in dataclasses is not inferred correctly · Issue #5723 · python/mypy
Description: Are you reporting a bug, or opening a feature request? bug Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would appreciate if you try to simplify your case to a minimal repro. fro...
Open Graph Description: Are you reporting a bug, or opening a feature request? bug Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would appreciate if you try to si...
X Description: Are you reporting a bug, or opening a feature request? bug Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would appreciate if you try to si...
Opengraph URL: https://github.com/python/mypy/issues/5723
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TypedDict as default_factory in dataclasses is not inferred correctly","articleBody":"* Are you reporting a bug, or opening a feature request? bug\r\n* Please insert below the code you are checking with mypy,\r\n or a mock-up repro if the source is private. We would appreciate\r\n if you try to simplify your case to a minimal repro.\r\n\r\n```python\r\nfrom dataclasses import dataclass, field\r\nfrom mypy_extensions import TypedDict\r\n\r\nclass Person(TypedDict, total=False):\r\n name: str\r\n\r\n@dataclass\r\nclass Job:\r\n person: Person = field(default_factory=Person)\r\n```\r\n\r\n* What is the actual behavior/output?\r\n\r\n```\r\nmain.py:9: error: Incompatible types in assignment (expression has type \"main.Person\", variable has type \"Person\")\r\n```\r\n\r\n* What is the behavior/output you expect? To pass\r\n* What are the versions of mypy and Python you are using? latest\r\n Do you see the same issue after installing mypy from Git master? yes\r\n* What are the mypy flags you are using? (For example --strict-optional) none","author":{"url":"https://github.com/iddan","@type":"Person","name":"iddan"},"datePublished":"2018-10-03T12:12:38Z","url":"https://github.com/python/mypy/issues/5723"}
| 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:e468ae76-ac5a-c190-6abd-da1e6e5d4235 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9278:3E19F2:B86993:F0F4A3:6AFFF181 |
| html-safe-nonce | c411599abfe9bb09085b73fdd283897f60c1a71d7c2e4c3956cf722a7163376b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Mjc4OjNFMTlGMjpCODY5OTM6RjBGNEEzOjZBRkZGMTgxIiwidmlzaXRvcl9pZCI6IjUxMjAzMDg3Nzc2OTc5MzE2NDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b56366e87ccc2dc4ab6eebf3f6749957ea9b2c45fe13d5adc2c3cc779a3de29c |
| hovercard-subject-tag | issue:366309318 |
| 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/5723/issue_layout |
| twitter:image | https://opengraph.githubassets.com/04fa0ad18fdf8bad078c04f1f60cc168e8f5c2d7ee45b0d93948f3301da6566b/python/mypy/issues/5723 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/04fa0ad18fdf8bad078c04f1f60cc168e8f5c2d7ee45b0d93948f3301da6566b/python/mypy/issues/5723 |
| og:image:alt | Are you reporting a bug, or opening a feature request? bug Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would appreciate if you try to si... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | iddan |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| 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 | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width