mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-43258: Don't allocate sqlite3 aggregate context for empty queries (GH-24569)
This commit is contained in:
parent
e92d67dfbb
commit
979b23cbe4
3 changed files with 13 additions and 2 deletions
|
@ -708,8 +708,12 @@ void _pysqlite_final_callback(sqlite3_context* context)
|
|||
|
||||
threadstate = PyGILState_Ensure();
|
||||
|
||||
aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*));
|
||||
if (!*aggregate_instance) {
|
||||
aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, 0);
|
||||
if (aggregate_instance == NULL) {
|
||||
/* No rows matched the query; the step handler was never called. */
|
||||
goto error;
|
||||
}
|
||||
else if (!*aggregate_instance) {
|
||||
/* this branch is executed if there was an exception in the aggregate's
|
||||
* __init__ */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue