-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-129915: Add __qualname__
to class namespace when constructing slotted dataclass
#129916
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
__qualname__
to class namespace when constructing slotted dataclass__qualname__
to class namespace when constructing slotted dataclass
Co-authored-by: sobolevn <mail@sobolevn.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, also add a NEWS entry.
class D(C): | ||
pass | ||
|
||
self.assertEqual(D.__qualname__, 'TestSlots.test_slots_qualname.<locals>.D') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please run your tests as -m test test_dataclasses
and as python.exe Lib/test/test_dataclasses/__init__.py
directly? qualname might be changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I'm not following how running it directly would produce a different result than the passing CI check? What am I missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume @sobolevn thinks the imported class name might change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I am not sure it will, just double checking.
The following commit authors need to sign the Contributor License Agreement: |
Fixes #129915 by shifting the "set the
__qualname__
" responsibility to be a property of the__qualname__
being inside the class namespace.(For the record, oof the bug was really painful to run into 😅 )
__qualname__
in slotted dataclasses in__init_subclass__
#129915