Title: Dataclasses without `__init__` no longer work in 3.14.1 due to #137711 · Issue #142214 · python/cpython · GitHub
Open Graph Title: Dataclasses without `__init__` no longer work in 3.14.1 due to #137711 · Issue #142214 · python/cpython
X Title: Dataclasses without `__init__` no longer work in 3.14.1 due to #137711 · Issue #142214 · python/cpython
Description: Bug report Bug description: The resolution for #137530, #137711 which was backported to 3.14 and included in 3.14.1, breaks dataclasses without __init__. Although a dataclass without __init__ doesn't seem that helpful, it doesn't seem to...
Open Graph Description: Bug report Bug description: The resolution for #137530, #137711 which was backported to 3.14 and included in 3.14.1, breaks dataclasses without __init__. Although a dataclass without __init__ doesn...
X Description: Bug report Bug description: The resolution for #137530, #137711 which was backported to 3.14 and included in 3.14.1, breaks dataclasses without __init__. Although a dataclass without __init__ doesn...
Opengraph URL: https://github.com/python/cpython/issues/142214
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Dataclasses without `__init__` no longer work in 3.14.1 due to #137711","articleBody":"# Bug report\n\n### Bug description:\n\nThe resolution for #137530, https://github.com/python/cpython/pull/137711 which was backported to 3.14 and included in 3.14.1, breaks dataclasses without `__init__`.\nAlthough a dataclass without `__init__` doesn't seem that helpful, it doesn't seem to be explicitly forbidden and shouldn't break in a point release.\n\n```python\nfrom dataclasses import dataclass, field\n\n@dataclass(slots=True, init=False)\nclass MyClass:\n attr: int\n\n def __new__(cls, attr: int) -\u003e Self:\n self.attr = attr\n return self\n```\n\nError message:\n``` pytb\n$ python3 dataclasses_issue.py\nTraceback (most recent call last):\n File \"/home/erik/dataclasses_issue.py\", line 3, in \u003cmodule\u003e\n @dataclass(slots=True, init=False)\n ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/erik/.pyenv/versions/3.14.1/lib/python3.14/dataclasses.py\", line 1426, in wrap\n return _process_class(cls, init, repr, eq, order, unsafe_hash,\n frozen, match_args, kw_only, slots,\n weakref_slot)\n File \"/home/erik/.pyenv/versions/3.14.1/lib/python3.14/dataclasses.py\", line 1234, in _process_class\n cls = _add_slots(cls, frozen, weakref_slot, fields)\n File \"/home/erik/.pyenv/versions/3.14.1/lib/python3.14/dataclasses.py\", line 1401, in _add_slots\n init_annotate = newcls.__init__.__annotate__\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'wrapper_descriptor' object has no attribute '__annotate__'. Did you mean: '__getstate__'?\n```\n\n### CPython versions tested on:\n\n3.14.1\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-142223\n* gh-142277\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/emontnemery","@type":"Person","name":"emontnemery"},"datePublished":"2025-12-03T08:15:03.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":21},"url":"https://github.com/142214/cpython/issues/142214"}
| 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:9de464f6-fecd-d1f5-23d6-82f5c08cba49 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BFEA:3D21D:195FF65:22C7B02:6964BB1F |
| html-safe-nonce | a10c1393ad688ff2426931b988ede55f3f73c81149842efa17e78042e0fcdf2b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRkVBOjNEMjFEOjE5NUZGNjU6MjJDN0IwMjo2OTY0QkIxRiIsInZpc2l0b3JfaWQiOiI3ODQ5ODMwNDEyMDUxNTk0MDE2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 711e674c834ae19e0652230b1b49cd2fe54663ecef1b0f701411b86dfa3de4bd |
| hovercard-subject-tag | issue:3689013694 |
| 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/cpython/142214/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9842508c184b3b671fd3264a5251797f84b9860fa36b033dfb0995a7eafb6001/python/cpython/issues/142214 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9842508c184b3b671fd3264a5251797f84b9860fa36b033dfb0995a7eafb6001/python/cpython/issues/142214 |
| og:image:alt | Bug report Bug description: The resolution for #137530, #137711 which was backported to 3.14 and included in 3.14.1, breaks dataclasses without __init__. Although a dataclass without __init__ doesn... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | emontnemery |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9917306ebdf5f9f30d13ede7b74f08a45b5f12b401ce3e4bfabd895ea0ca0ada |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | 020ceddb26807bba62dcfb410905847d63243ff5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width