Skip to content
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

Merged
merged 5 commits into from Oct 4, 2022

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Aug 29, 2022

I went with explicit .__dataclass_params__ attribute access instead of getattr(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 inspect kw_only on class/field.

@da-woods
Copy link
Contributor

da-woods commented Aug 31, 2022

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 inspect kw_only on class/field.

I think "include all the parameters" is a pretty defensible position too.

Copy link
Member

@ericvsmith ericvsmith left a comment

This is all great. Thanks! With the one nit about a comment, I'll accept this.

Lib/test/test_dataclasses.py Show resolved Hide resolved
Lib/test/test_dataclasses.py Show resolved Hide resolved
@bedevere-bot
Copy link

bedevere-bot commented Oct 3, 2022

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

And if you don't make the requested changes, you will be poked with soft cushions!

@sobolevn
Copy link
Member Author

sobolevn commented Oct 3, 2022

Done!

I have made the requested changes; please review again.

@bedevere-bot
Copy link

bedevere-bot commented Oct 3, 2022

Thanks for making the requested changes!

@ericvsmith: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from ericvsmith Oct 3, 2022
Copy link
Member

@ericvsmith ericvsmith left a comment

There are some trailing spaces that are causing CI failures. I haven't actually checked every line for trailing whitespace, just the ones I quickly found (I'm working on checking out the code, but you can probably check faster than my connection can clone the code).

@@ -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
Copy link
Member

@ericvsmith ericvsmith Oct 3, 2022

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.


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
Copy link
Member

@ericvsmith ericvsmith Oct 3, 2022

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.

@bedevere-bot
Copy link

bedevere-bot commented Oct 3, 2022

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@ericvsmith ericvsmith merged commit 4f380db into python:main Oct 4, 2022
14 checks passed
@sobolevn
Copy link
Member Author

sobolevn commented Oct 4, 2022

Thanks everyone!

Sign up for free to 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.

None yet

5 participants