New submission from Erlend Egeberg Aasland <erlend.aasl...@innova.no>:

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.

----------
components: Library (Lib)
messages: 387272
nosy: berker.peksag, erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Prevent needless allocation of sqlite3 aggregate function context
versions: Python 3.10

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43258>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to