Skip to content

Conversation

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Aug 12, 2025

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 [email protected]
Co-authored-by: Alyssa Coghlan [email protected]
Co-authored-by: Petr Viktorin [email protected]
Co-authored-by: Serhiy Storchaka [email protected]

…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 <[email protected]>
Co-authored-by: Alyssa Coghlan <[email protected]>
Co-authored-by: Petr Viktorin <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
@hugovk

This comment was marked as outdated.

@bedevere-bot

This comment was marked as outdated.

@hugovk
Copy link
Member

hugovk commented Aug 12, 2025

!buildbot aarch64 Fedora Stable LTO . PGO

@bedevere-bot
Copy link

🤖 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 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 <[email protected]>
Co-authored-by: Alyssa Coghlan <[email protected]>
Co-authored-by: Petr Viktorin <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

5 participants