]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class...
authorJelle Zijlstra <jelle.zijlstra@gmail.com>
Tue, 22 Jul 2025 04:43:34 +0000 (21:43 -0700)
committerGitHub <noreply@github.com>
Tue, 22 Jul 2025 04:43:34 +0000 (21:43 -0700)
commit46cbdf967ada11b0286060488b61635fd6a2bb23
tree6e48cdf5cb928511c3cf50e1b06fc723800b7197
parentbbe589f93ccaf32eb95fd9d1f8f3dc9a536e8db1
gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (#136893)

An interesting hack, but more localized in scope than #135230.

This may be a breaking change if people intentionally keep the original class around
when using `@dataclass(slots=True)`, and then use `__dict__` or `__weakref__` on the
original class.

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Lib/dataclasses.py
Lib/test/test_dataclasses/__init__.py
Misc/NEWS.d/next/Library/2025-07-20-16-56-55.gh-issue-135228.n_XIao.rst [new file with mode: 0644]