Skip to content

Conversation

corona10
Copy link
Member

@corona10 corona10 commented Jun 10, 2018

@corona10
Copy link
Member Author

@ericvsmith PTAL

Copy link
Member

@ericvsmith ericvsmith left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. See comments.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think it's worth adding this mapping and the new __str__ just for this one error message.

Copy link
Member

Choose a reason for hiding this comment

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

For consistency with the rest of the code, please change '{f.name}' to {f.name!r}. Also, just hard-code InitVar in the message, since this message is only applicable with InitVars.

Copy link
Member

Choose a reason for hiding this comment

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

The else is not needed.

Copy link
Member

Choose a reason for hiding this comment

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

Please add a test that shows that an InitVar does work with replace(), and check that its value is used (probably via a __post_init__ method). Maybe something like:

def __post_init__(self, y):
   self.x *= y

or similar.

Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer "Improve error message of dataclasses.replace() when an InitVar is not specified".

@bedevere-bot
Copy link

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.

@corona10 corona10 changed the title bpo-33805: Update error message of dataclasses.replace() bpo-33805: Improve error message of dataclasses.replace() Jun 10, 2018
@corona10
Copy link
Member Author

@ericvsmith
I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

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

@ericvsmith
Copy link
Member

Thanks! Looks good.

I'm going to wait a few days before I merge this, because at this late date I don't want to put this in to 3.7.0, I'll wait for 3.7.1.

@ericvsmith ericvsmith merged commit 3d70f7a into python:master Jun 23, 2018
@miss-islington
Copy link
Contributor

Thanks @corona10 for the PR, and @ericvsmith for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-7876 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 23, 2018
)

(cherry picked from commit 3d70f7a)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
miss-islington added a commit that referenced this pull request Jun 23, 2018
(cherry picked from commit 3d70f7a)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
@corona10 corona10 deleted the bpo-33805 branch June 25, 2018 04:50
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.

5 participants