This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [sqlite3] simplify executescript()
Type: enhancement Stage: resolved
Components: Extension Modules Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: erlendaasland, pablogsal
Priority: low Keywords: patch

Created on 2021-08-28 21:42 by erlendaasland, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 28020 merged erlendaasland, 2021-08-28 21:48
PR 28074 merged erlendaasland, 2021-08-30 20:45
PR 28509 merged erlendaasland, 2021-09-21 22:05
Messages (5)
msg400505 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-08-28 21:42
See also bpo-45040

Since sqlite3_finalize() will pass on any error message set by sqlite3_step(), we can greatly simplify SQLite C API usage and error handling in sqlite3.Cursor.executescript(), thus reducing the number of times we save/restore thread state, and also simplifying error handling greatly.

We can also "inline" the commit before the main loop using the SQLite API directly, instead of calling self.commit()

Diffstat for the proposed patch:
1 file changed, 25 insertions(+), 42 deletions(-)
msg400669 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-08-30 21:14
New changeset e34bb409197d72711ae2c6197f9d8305533034d4 by Erlend Egeberg Aasland in branch 'main':
bpo-45041: Increase coverage for sqlite3.Cursor.executescript() (GH-28074)
https://github.com/python/cpython/commit/e34bb409197d72711ae2c6197f9d8305533034d4
msg402180 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-09-19 22:52
New changeset a6779715c4d0289acb59a8fd3660ab2e5d486c4b by Erlend Egeberg Aasland in branch 'main':
bpo-45041: Simplify `sqlite3.Cursor.executescript()` (GH-28020)
https://github.com/python/cpython/commit/a6779715c4d0289acb59a8fd3660ab2e5d486c4b
msg402185 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-09-19 23:19
Thanks for reviewing, Pablo!
msg403366 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-10-07 09:17
New changeset 3f2c433da560d7999a52f9fcba4bbd0898848520 by Erlend Egeberg Aasland in branch 'main':
bpo-45041: Restore `sqlite3` executescript behaviour for `SELECT` queries (GH-28509)
https://github.com/python/cpython/commit/3f2c433da560d7999a52f9fcba4bbd0898848520
History
Date User Action Args
2022-04-11 14:59:49adminsetgithub: 89204
2021-10-07 09:17:03pablogsalsetmessages: + msg403366
2021-09-21 22:05:37erlendaaslandsetpull_requests: + pull_request26906
2021-09-19 23:19:22erlendaaslandsetstatus: open -> closed
resolution: fixed
messages: + msg402185

stage: patch review -> resolved
2021-09-19 22:52:40pablogsalsetmessages: + msg402180
2021-08-30 21:14:32pablogsalsetnosy: + pablogsal
messages: + msg400669
2021-08-30 20:45:39erlendaaslandsetpull_requests: + pull_request26518
2021-08-28 21:48:59erlendaaslandsetkeywords: + patch
stage: patch review
pull_requests: + pull_request26466
2021-08-28 21:42:20erlendaaslandcreate