FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-41747: Ensure all dataclass methods uses their parents' qualname by isidentical · Pull Request #22155 · python/cpython · GitHub

Repository navigation

bpo-41747: Ensure all dataclass methods uses their parents' qualname - #22155

Merged
ericvsmith merged 5 commits into
python:masterfrom
isidentical:bpo-41747
Oct 21, 2020
Merged

ericvsmith merged 5 commits into
python:masterfrom
isidentical:bpo-41747

Conversation

isidentical commented Sep 8, 2020 •
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

pablogsal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This LGTM but it would be great if @ericvsmith could take a final look

Comment thread Lib/dataclasses.py Outdated

Copy link
Copy Markdown

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.

serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Seems this change also makes these methods pickleable.

Comment thread Lib/dataclasses.py Outdated
# Never overwrites an existing attribute. Returns True if the
# attribute already exists.
if isinstance(value, FunctionType):
value.__qualname__ = f"{cls.__qualname__}.{value.__name__}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why value.__name__ and not name? Are they always the same?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

For all use cases, but since it got extracted to another function which only takes cls and value, I guess there is no need to complicate that function.

Comment thread Lib/test/test_dataclasses.py Outdated
Comment thread Lib/test/test_dataclasses.py Outdated
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

👍

ericvsmith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

With a few tiny issues, this looks good to me.

@serhiy-storchaka: Should we also add tests for pickling these methods? Or should that be another PR?

Comment thread Lib/dataclasses.py Outdated

Copy link
Copy Markdown

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.

Copy link
Copy Markdown
Member

I do not think that it is necessary to add tests for pickling these methods.

Copy link
Copy Markdown
Member Author

@ericvsmith a gentle ping.

Copy link
Copy Markdown
Member

Sorry for the delays. This is on my list of things to look at next week during the development sprints.

ericvsmith merged commit c7437e2 into python:master Oct 21, 2020
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
…ythonGH-22155)

* bpo-41747: Ensure all dataclass methods uses their parents' qualname

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

6 participants


Back | FazBrowse Home | New Git URL