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: Prevent needless allocation of sqlite3 aggregate function context
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, erlendaasland, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2021-02-18 22:21 by erlendaasland, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 24569 merged erlendaasland, 2021-02-18 22:46
PR 24574 merged erlendaasland, 2021-02-19 11:29
Messages (3)
msg387272 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-02-18 22:20
If no rows match an aggregate query, _pysqlite_step_callback() is never called, and _pysqlite_final_callback() is called once. In order to prevent needless context allocation, we should pass 0 as the second argument to sqlite3_aggregate_context().


Quoting from https://sqlite.org/c3ref/aggregate_context.html:

Within the xFinal callback, it is customary to set N=0 in calls to sqlite3_aggregate_context(C,N) so that no pointless memory allocations occur.
msg387305 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2021-02-19 11:21
New changeset 979b23cbe44071b056ff524c0aa20e5d9794b5b0 by Erlend Egeberg Aasland in branch 'master':
bpo-43258: Don't allocate sqlite3 aggregate context for empty queries (GH-24569)
https://github.com/python/cpython/commit/979b23cbe44071b056ff524c0aa20e5d9794b5b0
msg387309 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2021-02-19 11:59
New changeset 2bb0bf4dd8c0bd4d23eb04afce1a5eeee8e07982 by Erlend Egeberg Aasland in branch 'master':
bpo-43258: Make sqlite3 callback functions static (GH-24574)
https://github.com/python/cpython/commit/2bb0bf4dd8c0bd4d23eb04afce1a5eeee8e07982
History
Date User Action Args
2022-04-11 14:59:41adminsetgithub: 87424
2021-02-19 11:59:49berker.peksagsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-02-19 11:59:37berker.peksagsetmessages: + msg387309
2021-02-19 11:29:08erlendaaslandsetpull_requests: + pull_request23353
2021-02-19 11:21:03berker.peksagsetmessages: + msg387305
2021-02-18 22:46:02erlendaaslandsetkeywords: + patch
stage: patch review
pull_requests: + pull_request23348
2021-02-18 22:21:00erlendaaslandcreate