gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (take 2)#137047
Conversation
…ke the original class collectible (python#136893) An interesting hack, but more localized in scope than python#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. Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
serhiy-storchaka
left a comment
There was a problem hiding this comment.
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?
Sorry, something went wrong.
Maybe we can check that it's a heap type?
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. |
Sorry, something went wrong.
Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
@encukou @serhiy-storchaka could you review again and approve if you're satisfied, so that we can get this fixed in 3.14? |
Sorry, something went wrong.
encukou
left a comment
There was a problem hiding this comment.
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 is guaranteed to be garbage collected -- something else could still keep it alive.
Sorry, something went wrong.
|
@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. |
Sorry, something went wrong.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
Let's go then. |
Sorry, something went wrong.
6859b95
into
python:main
Aug 12, 2025
|
Thanks @JelleZijlstra for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, something went wrong.
…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>
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot aarch64 Fedora Stable LTO + PGO 3.x (tier-2) has failed when building commit 6859b95. What do you need to do:
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 logsremote: 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_HEAD
Note: switching to '6859b95cfff26c9ef52c5535d2b3662f17ff5b3d'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do 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 false
HEAD 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 directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
make[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 dumped
compilation terminated.
make[2]: *** [Makefile:1146: python] Error 1
make[1]: *** [Makefile:1005: profile-gen-stamp] Error 2
make: *** [Makefile:1017: profile-run-stamp] Error 2 |
Sorry, something went wrong.
|
Same buildbot passed on the backport: |
Sorry, something went wrong.
* 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)
…-136966) This partially reverts #137047, keeping the tests for GC collectability of the original 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 (within an interpreter). The `__objclass__` ol the descriptors is set to `object`, since these descriptors work with *any* object. (The appropriate checks were already made 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 also need adjusting. Co-authored-by: Jelle Zijlstra <jelle.zijlstra@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. Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com> Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…ct (pythonGH-136966) This partially reverts python#137047, keeping the tests for GC collectability of the original 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 (within an interpreter). The `__objclass__` ol the descriptors is set to `object`, since these descriptors work with *any* object. (The appropriate checks were already made 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 also need adjusting. Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
…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>
…_` and `__delattr__` in frozen dataclasses with slots (pythonGH-144021) pythongh-105936: Properly update closure cells for `__setattr__` and `__delattr__` in frozen dataclasses with slots (pythonGH-144021) (cherry picked from commit 8a398bf) The cherry-pick required additional changes beyond the original commit because 3.13 lacks the `__class__` closure cell fixup machinery that was added in 3.14 by pythonGH-124455 (pythongh-90562). Specifically: - Backported `_update_func_cell_for__class__()` helper function and the closure fixup loop in `_add_slots()` from pythonGH-124455. Without these, renaming the closure variable from `cls` to `__class__` has no effect because nothing updates the cell when the class is recreated with slots. - Changed `_add_slots()` to use `newcls` instead of reusing `cls` for the recreated class, so both old and new class references are available for the fixup loop. - Replaced `assertNotHasAttr` with `assertFalse(hasattr(...))` in tests (assertNotHasAttr was added in 3.14). - Dropped `test_original_class_is_gced` additions (that test does not exist on 3.13; it was added by pythonGH-137047 for pythongh-135228 which was not backported to 3.13). Co-authored-by: Prometheus3375 <prometheus3375@gmail.com> Co-authored-by: Sviataslau <35541026+Prometheus3375@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…_delattr__ in frozen dataclasses with slots (GH-144021) (GH-148476) gh-105936: Properly update closure cells for `__setattr__` and `__delattr__` in frozen dataclasses with slots (GH-144021) (cherry picked from commit 8a398bf) The cherry-pick required additional changes beyond the original commit because 3.13 lacks the `__class__` closure cell fixup machinery that was added in 3.14 by GH-124455 (gh-90562). Specifically: - Backported `_update_func_cell_for__class__()` helper function and the closure fixup loop in `_add_slots()` from GH-124455. Without these, renaming the closure variable from `cls` to `__class__` has no effect because nothing updates the cell when the class is recreated with slots. - Changed `_add_slots()` to use `newcls` instead of reusing `cls` for the recreated class, so both old and new class references are available for the fixup loop. - Replaced `assertNotHasAttr` with `assertFalse(hasattr(...))` in tests (assertNotHasAttr was added in 3.14). - Dropped `test_original_class_is_gced` additions (that test does not exist on 3.13; it was added by GH-137047 for gh-135228 which was not backported to 3.13). gh-148947: dataclasses: fix error on empty __class__ cell (GH-148948) Also add a test demonstrating the need for the existing "is oldcls" check. (cherry picked from commit 6d7bbee) --------- Co-authored-by: Prometheus3375 <prometheus3375@gmail.com> Co-authored-by: Sviataslau <35541026+Prometheus3375@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
This is a redo of #136893 without relying on a hack to get to the type dictionary.