FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.14] gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (take 2) (GH-137047) by miss-islington · Pull Request #137666 · python/cpython · GitHub

/ cpython Public

[3.14] gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (take 2) (GH-137047) - #137666

Merged
hugovk merged 1 commit into
python:3.14from
miss-islington:backport-6859b95-3.14
Aug 12, 2025
Merged

[3.14] gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (take 2) (GH-137047)#137666
hugovk merged 1 commit into
python:3.14from
miss-islington:backport-6859b95-3.14

Conversation

miss-islington commented Aug 12, 2025
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

Remove the __dict__ and __weakref__ descriptors from the original class when creating a dataclass from it.

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 6859b95)

Co-authored-by: Jelle Zijlstra jelle.zijlstra@gmail.com
Co-authored-by: Alyssa Coghlan ncoghlan@gmail.com
Co-authored-by: Petr Viktorin encukou@gmail.com
Co-authored-by: Serhiy Storchaka storchaka@gmail.com

…ke the original class collectible (take 2) (pythonGH-137047)

Remove the `__dict__` and `__weakref__` descriptors from the original class when creating a dataclass from it.

An interesting hack, but more localized in scope than pythongh-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 6859b95)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

This comment was marked as outdated.

This comment was marked as outdated.

hugovk commented Aug 12, 2025

Copy link
Copy Markdown
Member

!buildbot aarch64 Fedora Stable LTO . PGO

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @hugovk for commit d764eb6 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F137666%2Fmerge

The command will test the builders whose names match following regular expression: aarch64 Fedora Stable LTO . PGO

The builders matched are:

  • aarch64 Fedora Stable LTO + PGO PR

hugovk merged commit 4dda176 into python:3.14 Aug 12, 2025
52 checks passed
kumaraditya303 pushed a commit to miss-islington/cpython that referenced this pull request Sep 9, 2025
…ass, make the original class collectible (take 2) (pythonGH-137047) (python#137666)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington deleted the backport-6859b95-3.14 branch January 2, 2026 17:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL