-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-100450: Add sqlite.Row.__contains__
method
#100457
Conversation
6ba3bdd
to
5b089dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some nitpicks. Also, please add tests.
Modules/_sqlite/row.c
Outdated
static int | ||
pysqlite_row_contains(pysqlite_Row* self, PyObject *arg) | ||
{ | ||
Py_ssize_t nitems, i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use intermingled declarations :)
Modules/_sqlite/row.c
Outdated
for (i = 0; cmp == 0 && i < nitems; i++) { | ||
cmp = PyObject_RichCompareBool( | ||
arg, | ||
PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot happening on this line. I'd prefer it if you extracted these items before calling PyObject_RichCompareBool
, for improved readability.
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 |
@erlend-aasland Hmm, is this whole thing not wrong anyway? (See my comment in the issue thread.) |
I've added two doctests, aren't they enough? |
The doctests are there to make sure the examples in the docs actually work; it is not the place for unit tests. The unit tests (and regression tests, functional tests, etc.) all live in If I want to check the code coverage of the Also, I'm not sure the buildbots run doctests; IIRC, they only run the test suite, but I might be wrong about this. |
Sure, @erlend-aasland, I've added a unit test :) |
Thanks! BTW; I haven't decided if this is a good thing to add, or not. But lets keep that conversation on the issue. I'm going to mark this with do-not-merge until the discussion has landed. |
Should we open this to wider discussion on Discourse/Core development? |
Yeah, IMO it is worth it trying to gather more feedback on Discourse. |
I went ahead and added it :)
CC @erlend-aasland and @vsajip