GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [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

Conversation

@miss-islington

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

Uh oh!

There was an error while loading. Please reload this page.

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

  • Issue: 3.14 regression: slot dataclasses classes leak original class #135228

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@JelleZijlstra @ncoghlan
@encukou @serhiy-storchaka @miss-islington
pythongh-135228: When @DataClass(slots=True) replaces a dataclass, ma…
d764eb6
…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]>
@miss-islington
miss-islington requested review from ericsnowcurrently and ericvsmith as code owners August 12, 2025 11:17
@bedevere-app bedevere-app Bot added the awaiting review label Aug 12, 2025
This was referenced Aug 12, 2025
3.14 regression: slot dataclasses classes leak original class #135228
Closed
gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (take 2) #137047
Merged
@encukou encukou added the release-blocker label Aug 12, 2025
@github-project-automation github-project-automation Bot added this to Release and Deferred blockers 🚫 Aug 12, 2025
@github-project-automation github-project-automation Bot moved this to Todo in Release and Deferred blockers 🚫 Aug 12, 2025
@hugovk

This comment was marked as outdated.

Sign in to view
@bedevere-bot

This comment was marked as outdated.

Sign in to view
@hugovk

hugovk commented Aug 12, 2025

Copy link
Copy Markdown
Member

!buildbot aarch64 Fedora Stable LTO . PGO

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Aug 12, 2025

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
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

JelleZijlstra
JelleZijlstra approved these changes Aug 12, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Aug 12, 2025
@hugovk
hugovk merged commit 4dda176 into python:3.14 Aug 12, 2025
@github-project-automation github-project-automation Bot moved this from Todo to Done in Release and Deferred blockers 🚫 Aug 12, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Aug 12, 2025
kumaraditya303 pushed a commit to miss-islington/cpython that referenced this pull request Sep 9, 2025
@miss-islington @JelleZijlstra
@ncoghlan @encukou @serhiy-storchaka @kumaraditya303
[3.14] pythongh-135228: When @DataClass(slots=True) replaces a datacl…
4bd33e9
…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]>
@miss-islington
miss-islington deleted the backport-6859b95-3.14 branch January 2, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JelleZijlstra JelleZijlstra JelleZijlstra approved these changes
@ericvsmith ericvsmith Awaiting requested review from ericvsmith ericvsmith is a code owner
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

release-blocker

Projects

Release and Deferred blockers 🚫
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@miss-islington @hugovk @bedevere-bot @JelleZijlstra @encukou
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.