mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-129346: Handle allocation errors for SQLite aggregate context (#129347)
This commit is contained in:
parent
a6a8c6f86e
commit
379ab856f5
2 changed files with 7 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
In :mod:`sqlite3`, handle out-of-memory when creating user-defined SQL
|
||||
functions.
|
|
@ -958,6 +958,11 @@ step_callback(sqlite3_context *context, int argc, sqlite3_value **params)
|
|||
assert(ctx != NULL);
|
||||
|
||||
aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*));
|
||||
if (aggregate_instance == NULL) {
|
||||
(void)PyErr_NoMemory();
|
||||
set_sqlite_error(context, "unable to allocate SQLite aggregate context");
|
||||
goto error;
|
||||
}
|
||||
if (*aggregate_instance == NULL) {
|
||||
*aggregate_instance = PyObject_CallNoArgs(ctx->callable);
|
||||
if (!*aggregate_instance) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue