Skip to content

Conversation

@sobolevn
Copy link
Member

@sobolevnsobolevn commented Sep 11, 2024

Refs #118099

Local tests to better understand the problem / test. With this change:

from_testcapiimportHeapCTypeWithDict, HeapCTypeWithWeakreffromdataclassesimport_get_slotsassertlist(_get_slots(HeapCTypeWithWeakref)) == ['__weakref__'] assertlist(_get_slots(HeapCTypeWithDict)) == ['__dict__']

Without this change:

assertlist(_get_slots(HeapCTypeWithWeakref)) == ['__weakref__', '__dict__']

But, since there's no public api to set __dict__ slot similar to weakref_slot, I had to use __dict__ as a field name. This is very ugly, I fully understand that. If prefered, I can remove the test completely.

@picnixzpicnixz added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Sep 11, 2024
@sobolevn
Copy link
MemberAuthor

Done! 👍

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@miss-islington-app
Copy link

Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 12, 2024
…GH-123941) (cherry picked from commit ac918cc) Co-authored-by: sobolevn <mail@sobolevn.me>
@bedevere-app
Copy link

GH-123991 is a backport of this pull request to the 3.13 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 12, 2024
…GH-123941) (cherry picked from commit ac918cc) Co-authored-by: sobolevn <mail@sobolevn.me>
@bedevere-appbedevere-appbot removed the needs backport to 3.13 bugs and security fixes label Sep 12, 2024
@bedevere-app
Copy link

GH-123992 is a backport of this pull request to the 3.12 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.12 only security fixes label Sep 12, 2024
@sobolevn
Copy link
MemberAuthor

Thank you! 🎉

sobolevn added a commit that referenced this pull request Sep 12, 2024
…3941) (#123992) gh-123935: Fix typo in `_get_slots` in `dataclasses.py` (GH-123941) (cherry picked from commit ac918cc) Co-authored-by: sobolevn <mail@sobolevn.me>
Yhg1s pushed a commit that referenced this pull request Dec 3, 2024
…3941) (#123991) gh-123935: Fix typo in `_get_slots` in `dataclasses.py` (GH-123941) (cherry picked from commit ac918cc) Co-authored-by: sobolevn <mail@sobolevn.me>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@sobolevn@vstinner@picnixz