bpo-25750: add testcase on bad descriptor __get__() - #9084
Conversation
762b8ed to
4da39be
Compare
If that's a problem, I could do |
|
NEWS entry is already there (from #6118). Even if it's an edge case, I think the regression test should be merged. |
|
@encukou: Would you just mind to approve the change in that case? @serhiy-storchaka: What do you think? I don't have an opinion strong enough against this change to block it. @encukou: if you want to, please go ahead :-) |
| self.assertRegex(repr(method), | ||
| r"<bound method qualname of <object object at .*>>") | ||
|
|
||
| @unittest.skipIf(_testcapi is None, 'need the _testcapi module') |
There was a problem hiding this comment.
We can wrap the test with @cpython_only.
There was a problem hiding this comment.
I wanted to propose the same change, but IMHO @unittest.skipIf(_testcapi is None, ...) is fine since _testcapi is specific to CPython and it's a common pattern.
There was a problem hiding this comment.
cpython_only serves also documenting purpose. It is common to decorate all tests that use _testcapi with cpython_only.
There was a problem hiding this comment.
@jdemeyer: Would you mind to add @cpython_only? IMHO it's better to add it first, before "_testcapi is None".
There was a problem hiding this comment.
Would you mind to add @cpython_only? IMHO it's better to add it first, before "_testcapi is None".
Do we really need both? Doesn't @cpython_only imply that _testcapi is available?
serhiy-storchaka
left a comment
There was a problem hiding this comment.
I don't have opinion about adding this test. Technically it looks correct.
| self.assertRegex(repr(method), | ||
| r"<bound method qualname of <object object at .*>>") | ||
|
|
||
| @unittest.skipIf(_testcapi is None, 'need the _testcapi module') |
There was a problem hiding this comment.
cpython_only serves also documenting purpose. It is common to decorate all tests that use _testcapi with cpython_only.
|
I was the one who blocked the addition of the test. It seems like everybody likes the test, there was just a minor discussion on the @cpython_only decorator. I dislike seeing this PR stuck for such non-blocker issue, so I decided to merge it. Thanks @jdemeyer for this test. Sorry for being so pendantic :-) |

This adds a testcase for bpo-25750 (#6118). This is a separate pull request since the testcase is possibly controversial.
https://bugs.python.org/issue25750