Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
encukou merged 9 commits intopython:mainfromJelleZijlstra:dataclasses-hack-v2
Aug 12, 2025

Conversation

@JelleZijlstra
Copy link
Member

@JelleZijlstraJelleZijlstra commentedJul 23, 2025
edited by bedevere-appbot
Loading

This is a redo of#136893 without relying on a hack to get to the type dictionary.

JelleZijlstraand others added3 commitsJuly 23, 2025 08:13
…ke the original class collectible (python#136893)An interesting hack, but more localized in scope thanpython#135230.This may be a breaking change if people intentionally keep the original class aroundwhen using `@dataclass(slots=True)`, and then use `__dict__` or `__weakref__` on theoriginal class.Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can we check that this is a Python class? Should we clear the whole class dict or set it to NULL for the case if there are more descriptors?

@JelleZijlstra
Copy link
MemberAuthor

Can we check that this is a Python class?

Maybe we can check that it's a heap type?

Should we clear the whole class dict or set it to NULL for the case if there are more descriptors?

I'm not aware of other descriptors that could cause problems. It's better to minimize the amount of changes we make to the class, because there are edge cases where the class is still accessible after the dataclass transformation is applied.

Co-authored-by: Petr Viktorin <encukou@gmail.com>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@JelleZijlstra
Copy link
MemberAuthor

@encukou@serhiy-storchaka could you review again and approve if you're satisfied, so that we can get this fixed in 3.14?

Copy link
Member

@encukouencukou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I can't find any issues in the PR; this is pretty much is the local optimum.
But, I can't tell if there will be unintended consequences. This PR feels quite risky for a RC fix.

Docs-wise: the notes/comments shouldn't imply that the original class isguaranteed to be garbage collected -- something else could still keep it alive.

@encukou
Copy link
Member

@hugovk Your thoughts on this?

IMO: If we weren't in RC period, I'd push for#136966, which is IMO a (slight) improvement on its own. But, it has a higher risk of unknown unknowns.
For backporting to 3.14.0, this dataclasses-specific workaround is probably better. But, all of it is a band-aid.

serhiy-storchaka reacted with thumbs up emoji

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I agree with@encukou.#136966 may be better in long perspective (or it may be a move in right direction), but this change has more limited impact, and therefore lokks safer. We always can backport#136966 if we test it well.

@JelleZijlstra
Copy link
MemberAuthor

I also agree that#136966 is a better long-term solution; we can merge it into 3.15 after this goes in, and we can also consider using it in 3.14.1.

@encukou
Copy link
Member

Let's go then.

@encukouencukou merged commit6859b95 intopython:mainAug 12, 2025
42 checks passed
@miss-islington-app
Copy link

Thanks@JelleZijlstra for the PR, and@encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestAug 12, 2025
…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 thanpythongh-135230.This may be a breaking change if people intentionally keep the original class aroundwhen using `@dataclass(slots=True)`, and then use `__dict__` or `__weakref__` on theoriginal class.(cherry picked from commit6859b95)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>
@bedevere-app
Copy link

GH-137666 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelAug 12, 2025
@hugovk
Copy link
Member

hugovk commentedAug 12, 2025
edited
Loading

Thanks all, let's do this fix for RC2 -- I'll merge the backport#137666 once tests pass and it's approved.

And do#136966 for 3.15 and possibly 3.14.1.

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure⚠️⚠️⚠️

Hi! The buildbotaarch64 Fedora Stable LTO + PGO 3.x (tier-2) has failed when building commit6859b95.

What do you need to do:

  1. Don't panic.
  2. Checkthe buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/524/builds/8141) and take a look at the build logs.
  4. Check if the failure is related to this commit (6859b95) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/524/builds/8141

Summary of the results of the build (if available):

Click to see traceback logs
remote:Enumerating objects: 14, done.remote:Counting objects:   9% (1/11)remote:Counting objects:  18% (2/11)remote:Counting objects:  27% (3/11)remote:Counting objects:  36% (4/11)remote:Counting objects:  45% (5/11)remote:Counting objects:  54% (6/11)remote:Counting objects:  63% (7/11)remote:Counting objects:  72% (8/11)remote:Counting objects:  81% (9/11)remote:Counting objects:  90% (10/11)remote:Counting objects: 100% (11/11)remote:Counting objects: 100% (11/11), done.remote:Compressing objects:  11% (1/9)remote:Compressing objects:  22% (2/9)remote:Compressing objects:  33% (3/9)remote:Compressing objects:  44% (4/9)remote:Compressing objects:  55% (5/9)remote:Compressing objects:  66% (6/9)remote:Compressing objects:  77% (7/9)remote:Compressing objects:  88% (8/9)remote:Compressing objects: 100% (9/9)remote:Compressing objects: 100% (9/9), done.remote:Total 14 (delta 2), reused 2 (delta 2), pack-reused 3 (from 1)From https://github.com/python/cpython * branch                    main       -> FETCH_HEADNote:switching to '6859b95cfff26c9ef52c5535d2b3662f17ff5b3d'.You are in 'detached HEAD' state. You can look around, make experimentalchanges and commit them, and you can discard any commits you make in thisstate without impacting any branches by switching back to a branch.If you want to create a new branch to retain commits you create, you maydo so (now or later) by using -c with the switch command. Example:  git switch -c <new-branch-name>Or undo this operation with:  git switch -Turn off this advice by setting config variable advice.detachedHead to falseHEAD is now at 6859b95cfff gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (take 2) (GH-137047)Switched to and reset branch 'main'find:‘build’: No such file or directoryfind:‘build’: No such file or directoryfind:‘build’: No such file or directoryfind:‘build’: No such file or directorymake[2]:[Makefile:3379: clean-retain-profile] Error 1 (ignored)Python/ceval.c:In function ‘_PyEvalFramePushAndInit_Ex’:Python/ceval.c:1917:38: warning: ‘stack_array’ may be used uninitialized [-Wmaybe-uninitialized] 1917 |     _PyInterpreterFrame *new_frame = _PyEvalFramePushAndInit(|^~~~~~~~~~~~~~~~~~~~~~~~ 1918 |         tstate, func, locals,|~~~~~~~~~~~~~~~~~~~~~          1919 |         newargs, nargs, kwnames, previous|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1920 |     );|~                                 Python/ceval.c:1840:1: note: by argument 4 of type ‘const union _PyStackRef *’ to ‘_PyEvalFramePushAndInit’ declared here 1840 | _PyEvalFramePushAndInit(PyThreadState *tstate, _PyStackRef func,|^~~~~~~~~~~~~~~~~~~~~~~Python/ceval.c:1886:17: note: ‘stack_array’ declared here 1886 |     _PyStackRef stack_array[8];|^~~~~~~~~~~/usr/bin/ld:error in /usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o)(.eh_frame); no .eh_frame_hdr table will be created/usr/bin/ld:error in /usr/lib/gcc/aarch64-redhat-linux/15/libgcc.a(sync-cache.o)(.eh_frame); no .eh_frame_hdr table will be created/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 1090522845 >= 662 for section `.strtab'/usr/bin/ld:/usr/lib/gcc/aarch64-redhat-linux/15/libgcov.a(_gcov.o): invalid string offset 3236147 >= 662 for section `.strtab'collect2:fatal error: ld terminated with signal 11 [Segmentation fault], core dumpedcompilation terminated.make[2]:*** [Makefile:1146: python] Error 1make[1]:*** [Makefile:1005: profile-gen-stamp] Error 2make:*** [Makefile:1017: profile-run-stamp] Error 2

hugovk pushed a commit that referenced this pull requestAug 12, 2025
…ake the original class collectible (take 2) (GH-137047) (#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>
maurycy added a commit to maurycy/cpython that referenced this pull requestAug 12, 2025
* main:pythongh-137288: Update 3.14 magic numbers (pythonGH-137665)pythongh-135228: When@DataClass(slots=True) replaces a dataclass, make the original class collectible (take 2) (pythonGH-137047)pythongh-126008: Improve docstrings for Tkinter cget and configure methods (pythonGH-133303)pythongh-131885: Use positional-only markers for ``max()`` and ``min()`` (python#131868)pythonGH-137426: Remove code deprecation of `importlib.abc.ResourceLoader` (pythonGH-137567)pythongh-125897: Mark range function parameters as positional only (python#125945)pythongh-137400: Fix a crash when disabling profiling across all threads (pythongh-137471)pythongh-115766: Fix IPv4Interface.is_unspecified (pythonGH-137326)pythongh-128813: cleanup C-API docs for PyComplexObject (pythonGH-137579)pythongh-135953: Profile a module or script with sampling profiler (python#136777)  Fix documentation of hash in PyHash_FuncDef (python#137595)
encukou added a commit that referenced this pull requestAug 18, 2025
…-136966)This partially reverts#137047, keeping the tests for GC collectability of theoriginal class that dataclass adds `__slots__` to.The reference leaks solved there are instead solved by having the `__dict__` &`__weakref__` descriptors not tied to (and referencing) their class.Instead, they're shared between all classes that need them (withinan interpreter).The `__objclass__` ol the descriptors is set to `object`, since thesedescriptors work with *any* object. (The appropriate checks were alreadymade in the get/set code, so the `__objclass__` check was redundant.)The repr of these descriptors (and any others whose `__objclass__` is `object`)now doesn't mention the objclass.This change required adjustment of introspection code that checks`__objclass__` to determine an object's “own” (i.e. not inherited) `__dict__`.Third-party code that does similar introspection of the internals will alsoneed adjusting.Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull requestAug 19, 2025
…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 thanpythongh-135230.This may be a breaking change if people intentionally keep the original class aroundwhen using `@dataclass(slots=True)`, and then use `__dict__` or `__weakref__` on theoriginal class.Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>Co-authored-by: Petr Viktorin <encukou@gmail.com>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull requestAug 19, 2025
…ct (pythonGH-136966)This partially revertspython#137047, keeping the tests for GC collectability of theoriginal class that dataclass adds `__slots__` to.The reference leaks solved there are instead solved by having the `__dict__` &`__weakref__` descriptors not tied to (and referencing) their class.Instead, they're shared between all classes that need them (withinan interpreter).The `__objclass__` ol the descriptors is set to `object`, since thesedescriptors work with *any* object. (The appropriate checks were alreadymade in the get/set code, so the `__objclass__` check was redundant.)The repr of these descriptors (and any others whose `__objclass__` is `object`)now doesn't mention the objclass.This change required adjustment of introspection code that checks`__objclass__` to determine an object's “own” (i.e. not inherited) `__dict__`.Third-party code that does similar introspection of the internals will alsoneed adjusting.Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
kumaraditya303 pushed a commit to miss-islington/cpython that referenced this pull requestSep 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>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@encukouencukouencukou left review comments

@brandtbucherbrandtbucherbrandtbucher left review comments

@serhiy-storchakaserhiy-storchakaserhiy-storchaka approved these changes

@ericvsmithericvsmithAwaiting requested review from ericvsmithericvsmith is a code owner

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrentlyericsnowcurrently is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@JelleZijlstra@encukou@hugovk@bedevere-bot@serhiy-storchaka@brandtbucher

[8]ページ先頭

©2009-2025 Movatter.jp