[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

2020-02-01 Thread Berker Peksag
Berker Peksag added the comment: New changeset 78c7183f470b60a39ac2dd0ad1a94d49d1e0b062 by Alex Henrie in branch 'master': bpo-39496: Remove redundant checks from _sqlite/cursor.c (GH-18270) https://github.com/python/cpython/commit/78c7183f470b60a39ac2dd0ad1a94d49d1e0b062 -- nosy:

[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

2020-02-01 Thread Berker Peksag
Change by Berker Peksag : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

2020-02-01 Thread Alex Henrie
Alex Henrie added the comment: Sorry about that, I didn't notice that GCC's -Wall option emits a warning about this. I just added the extra sets of parentheses. -- ___ Python tracker

[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

2020-01-31 Thread Vedran Čačić
Vedran Čačić added the comment: It seems you haven't read carefully what I've written. This way some compilers might emit warnings. Please read https://stackoverflow.com/questions/5476759/compiler-warning-suggest-parentheses-around-assignment-used-as-truth-value --

[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

2020-01-31 Thread Alex Henrie
Alex Henrie added the comment: You're right, that's even better. I forgot that the equals operator also returns the variable's new value. I just updated my pull request :-) -- ___ Python tracker

[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

2020-01-31 Thread Vedran Čačić
Vedran Čačić added the comment: You mean, something like while ((row = pysqlite_cursor_iternext(self))) { PyList_Append(list, row); Py_DECREF(row); } ? It's interesting that now we have walrus in Python, we see the opportunities for it in other languages. (In

[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

2020-01-29 Thread Alex Henrie
Change by Alex Henrie : -- keywords: +patch pull_requests: +17645 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18270 ___ Python tracker ___

[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

2020-01-29 Thread Alex Henrie
New submission from Alex Henrie : pysqlite_cursor_fetchall currently has the following bit of code: /* just make sure we enter the loop */ row = (PyObject*)Py_None; while (row) { row = pysqlite_cursor_iternext(self); if (row) { PyList_Append(list, row);