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
gh-96142: add missing params to dataclass._DataclassParams
#96382
Conversation
I think "include all the parameters" is a pretty defensible position too. |
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be poked with soft cushions! |
Done! I have made the requested changes; please review again. |
Thanks for making the requested changes! @ericvsmith: please review the changes made to this pull request. |
Lib/test/test_dataclasses.py
Outdated
@@ -68,6 +68,32 @@ def test_field_repr(self): | |||
|
|||
self.assertEqual(repr_output, expected_output) | |||
|
|||
def test_dataclass_params_repr(self): | |||
# Even though this is testing an internal implementation detail, | |||
# it's testing a feature we want to make sure is correctly implemented |
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.
There's a trailing space on this line that is causing a CI failure.
Lib/test/test_dataclasses.py
Outdated
|
||
def test_dataclass_params_signature(self): | ||
# Even though this is testing an internal implementation detail, | ||
# it's testing a feature we want to make sure is correctly implemented |
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.
Same thing here with a trailing space.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Thanks everyone! |
I went with explicit
.__dataclass_params__
attribute access instead ofgetattr(klass, _PARAMS)
because it felt more safe and concete to me.I've also considered
kw_only
argument by @da-woods, but it feels like_DataclassParams
structure must just hold passed arguments without much logic in it. It is up to the caller to inspectkw_only
on class/field.match_args
,slots
and possiblykw_only
missing from__dataclass_params__
#96142