Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into bpo-36859
  • Loading branch information
Erlend E. Aasland
Erlend E. Aasland committed Jun 8, 2021
commit 7c01d5ad58dae03b60632db6f8c27d52f914c437
22 changes: 9 additions & 13 deletions Modules/_sqlite/statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ pysqlite_statement_is_dml(sqlite3_stmt *statement, const char *sql)
pysqlite_Statement *
pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql)
{
const char* tail;
int rc;
const char* sql_cstr;
Py_ssize_t sql_cstr_len;

assert(PyUnicode_Check(sql));
Py_ssize_t size;
const char *sql_cstr = PyUnicode_AsUTF8AndSize(sql, &size);
Expand Down Expand Up @@ -126,15 +121,16 @@ pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql)
goto error;
}

Py_BEGIN_ALLOW_THREADS
rc = sqlite3_prepare_v2(self->db,
sql_cstr,
(int)sql_cstr_len + 1,
&self->st,
&tail);
Py_END_ALLOW_THREADS
pysqlite_Statement *self = PyObject_GC_New(pysqlite_Statement,
pysqlite_StatementType);
if (self == NULL) {
goto error;
}

self->is_dml = pysqlite_statement_is_dml(self->st, sql_cstr);
self->st = stmt;
self->in_use = 0;
self->is_dml = pysqlite_statement_is_dml(stmt, sql_cstr);
self->in_weakreflist = NULL;

PyObject_GC_Track(self);
return self;
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.