]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 22 Jul 2025 05:08:15 +0000 (07:08 +0200)
committerGitHub <noreply@github.com>
Tue, 22 Jul 2025 05:08:15 +0000 (05:08 +0000)
commit6e1b31b87e7a42c7911b517b78fc418217e6480c
tree2c98707bd680cc8376267e7e20a38f0bee687b1f
parentcaef946a25aac557f13cb66fbc70f06225546e67
[3.14] gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (GH-136893) (#136960)

gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (GH-136893)

An interesting hack, but more localized in scope than GH-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.
(cherry picked from commit 46cbdf967ada11b0286060488b61635fd6a2bb23)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
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]