GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-26103 resolve Data descriptor contradiction by aaronchall · Pull Request #1959 · python/cpython Conversation
|
|
@aaronchall, thanks for your PR! By analyzing the history of the files in this pull request, we identified @zestyping, @ethanfurman and @birkenfeld to be potential reviewers. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…l/cpython into datadescrcontradiction
…l/cpython into datadescrcontradiction must add tests
| class TestIsDataDescriptor(unittest.TestCase): | ||
|
|
||
| def test_custom_descriptors(self): | ||
| class NonDataDescriptor(object): |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why do you specify the object class for the parent ? it is not required https://docs.python.org/3/reference/compound_stmts.html#class-definitions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This could be backported to 2, it is ostensibly fixing an incorrect implementation.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Keep the Python 3 code clear. Add the object class in a backport to Python 2.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
As it currently stands I am perfectly happy with this revision, but I am more than willing to consider change requests. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| class TestIsDataDescriptor(unittest.TestCase): | ||
|
|
||
| def test_custom_descriptors(self): | ||
| class NonDataDescriptor(object): |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Keep the Python 3 code clear. Add the object class in a backport to Python 2.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| def test_functions(self): | ||
| class Test(object): | ||
| def instance_method(self): '' |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Use pass for empty body.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| a_lambda = lambda: '' | ||
| self.assertFalse(inspect.isdatadescriptor(type(Test().instance_method)), | ||
| 'a instance method is not a data descriptor') | ||
| self.assertFalse(inspect.isdatadescriptor(classmethod), |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why you test classmethod? Note that the type of class method is not classmethod.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| 'a instance method is not a data descriptor') | ||
| self.assertFalse(inspect.isdatadescriptor(classmethod), | ||
| 'a class method is not a data descriptor') | ||
| self.assertFalse(inspect.isdatadescriptor(staticmethod), |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| attrs = [a[0] for a in inspect.getmembers(C)] | ||
| self.assertNotIn('missing', attrs) | ||
|
|
||
| class TestIsDataDescriptor(unittest.TestCase): |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
These tests are not ran. Add the test class in run_unittest() list below.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Added
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| def __delete__(self, name): "" | ||
| class DataDescriptor2(object): | ||
| __set__ = None | ||
| self.assertFalse(inspect.isdatadescriptor(NonDataDescriptor), |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This returns False because NonDataDescriptor is a class.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| __set__ = None | ||
| self.assertFalse(inspect.isdatadescriptor(NonDataDescriptor), | ||
| 'class with only __get__ not a data descriptor') | ||
| self.assertTrue(inspect.isdatadescriptor(DataDescriptor0), |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This test would fail if TestIsDataDescriptor run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I thought it was, "I didn't expect a kind of Spanish Inquisition!" not, I didn't expect the Spanish Inquisition! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Nobody expects the Spanish Inquisition! @serhiy-storchaka: please review the changes made to this pull request. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@serhiy-storchaka Do you want an entry in the Misc/NEWS.d directory? If I do that, should I remove the entry in Misc/NEWS? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thank you @aaronchall! LGTM. But since this is related to delicate matters, it would be nice if yet one core dev will take a look.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
In general, this seems fine. My one nit is that rather than "and/or", let's just say "or". "and/or" is jargony. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@benjaminp done, however, the "appveyor" build failed - not sure why, appears to be irrelevant. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.