Skip to content

bpo-38336: Remove the __set__ method restriction on data descriptors for attribute lookup precedence#16520

Merged
rhettinger merged 3 commits into
python:masterfrom
geryogam:patch-11
Oct 29, 2019
Merged

bpo-38336: Remove the __set__ method restriction on data descriptors for attribute lookup precedence#16520
rhettinger merged 3 commits into
python:masterfrom
geryogam:patch-11

Conversation

@geryogam

@geryogam geryogam commented Oct 1, 2019

Copy link
Copy Markdown
Contributor

The language documentation states:

Data descriptors with __set__() and __get__() defined always override a redefinition in an instance dictionary. In contrast, non-data descriptors can be overridden by instances.

This override is not limited to data descriptors defining __set__() (and __get__()). It is also true for data descriptors defining __delete__() (and __get__()) and data descriptors defining both __set__() and __delete__() (and __get__()).

In other words, any data descriptors (objects defining either __set__() or __delete__() or both) defining __get__() override an attribute redefinition in an instance dictionary.

https://bugs.python.org/issue38336

@bedevere-bot bedevere-bot added docs Documentation in the Doc dir awaiting review labels Oct 1, 2019
@geryogam geryogam changed the title Remove the __set__ method restriction on data descriptors for attribute lookup precedence bpo-38336: Remove the __set__ method restriction on data descriptors for attribute lookup precedence Oct 1, 2019

@brandtbucher brandtbucher 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.

Thanks @maggyero, looks good to me!

Comment thread Doc/reference/datamodel.rst Outdated
@bedevere-bot

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.

@geryogam

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again.

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

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

Comment thread Doc/reference/datamodel.rst Outdated
@bedevere-bot

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.

@geryogam

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again.

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

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

@rhettinger
rhettinger merged commit 4c155f7 into python:master Oct 29, 2019
@geryogam
geryogam deleted the patch-11 branch October 29, 2019 07:32
@geryogam

Copy link
Copy Markdown
Contributor Author

Thanks @rhettinger for reviewing this.

jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants