Title: `dataclasses` plugins does not respect `slots=True` argument · Issue #11482 · python/mypy · GitHub
Open Graph Title: `dataclasses` plugins does not respect `slots=True` argument · Issue #11482 · python/mypy
X Title: `dataclasses` plugins does not respect `slots=True` argument · Issue #11482 · python/mypy
Description: Since 3.10 now has slots=True argument for @dataclass decorator, we need to support it, since #10864 is merged. Failing case right now: from dataclasses import dataclass @dataclass(slots=True) class Some: x: int def __init__(self, x: int...
Open Graph Description: Since 3.10 now has slots=True argument for @dataclass decorator, we need to support it, since #10864 is merged. Failing case right now: from dataclasses import dataclass @dataclass(slots=True) clas...
X Description: Since 3.10 now has slots=True argument for @dataclass decorator, we need to support it, since #10864 is merged. Failing case right now: from dataclasses import dataclass @dataclass(slots=True) clas...
Opengraph URL: https://github.com/python/mypy/issues/11482
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`dataclasses` plugins does not respect `slots=True` argument","articleBody":"Since `3.10` now has `slots=True` argument for `@dataclass` decorator, we need to support it, since https://github.com/python/mypy/pull/10864 is merged.\r\n\r\nFailing case right now:\r\n\r\n```python\r\nfrom dataclasses import dataclass\r\n\r\n@dataclass(slots=True)\r\nclass Some:\r\n x: int\r\n\r\n def __init__(self, x: int) -> None:\r\n self.x = x # ok\r\n self.y = 1 # should be an error, but `mypy` is ok\r\n # Traceback (most recent call last):\r\n # ...\r\n # AttributeError: 'Some' object has no attribute 'y'\r\n```\r\n\r\nCompare it with regular class, which works fine:\r\n\r\n```python\r\nclass Some:\r\n __slots__ = ('x',)\r\n\r\n def __init__(self, x: int) -> None:\r\n self.x = x # ok\r\n self.y = 1 # E: Trying to assign name \"y\" that is not in \"__slots__\" of type \"ex.Some\"\r\n```\r\n\r\nDocs: https://docs.python.org/3/library/dataclasses.html#dataclasses.dataclass\r\n\r\nRefs #11463","author":{"url":"https://github.com/sobolevn","@type":"Person","name":"sobolevn"},"datePublished":"2021-11-06T09:51:03Z","url":"https://github.com/python/mypy/issues/11482"}
| 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:2c41f53c-7b79-377b-73b2-fae7cd9f8fb3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B578:22BD05:23F0E83:30C89B8:6B002FFF |
| html-safe-nonce | ed4800adbcfa79375b7a625cfbef9ec25940b2ea2af780558dcfa869cc46b06b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTc4OjIyQkQwNToyM0YwRTgzOjMwQzg5Qjg6NkIwMDJGRkYiLCJ2aXNpdG9yX2lkIjoiNzMzODQzNjYzMDg3NDgwODMxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2ab026ae250edcfbbd25fe22463f98dff5233cc2012f2943ae0bb532ce56a5dd |
| hovercard-subject-tag | issue:1046473532 |
| 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/11482/issue_layout |
| twitter:image | https://opengraph.githubassets.com/80780d947eb56fc50d7ecff5c45b766a23b2a49d51d6a2b904cf9595e557fb7b/python/mypy/issues/11482 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/80780d947eb56fc50d7ecff5c45b766a23b2a49d51d6a2b904cf9595e557fb7b/python/mypy/issues/11482 |
| og:image:alt | Since 3.10 now has slots=True argument for @dataclass decorator, we need to support it, since #10864 is merged. Failing case right now: from dataclasses import dataclass @dataclass(slots=True) clas... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sobolevn |
| 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