Skip to content

bpo-46634: Inline calls to Connection.cursor() in sqlite3 #31127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
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
11 changes: 3 additions & 8 deletions Modules/_sqlite/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ class _sqlite3.Connection "pysqlite_Connection *" "clinic_state()->ConnectionTyp
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=67369db2faf80891]*/

_Py_IDENTIFIER(cursor);

static void _pysqlite_drop_unused_cursor_references(pysqlite_Connection* self);
static void free_callback_context(callback_context *ctx);
static void set_callback_context(callback_context **ctx_pp,
Expand Down Expand Up @@ -1431,10 +1429,9 @@ pysqlite_connection_execute_impl(pysqlite_Connection *self, PyObject *sql,
/*[clinic end generated code: output=5be05ae01ee17ee4 input=fbd17c75c7140271]*/
{
_Py_IDENTIFIER(execute);
PyObject* cursor = 0;
PyObject* result = 0;

cursor = _PyObject_CallMethodIdNoArgs((PyObject*)self, &PyId_cursor);
PyObject *cursor = pysqlite_connection_cursor_impl(self, NULL);
if (!cursor) {
goto error;
}
Expand Down Expand Up @@ -1466,10 +1463,9 @@ pysqlite_connection_executemany_impl(pysqlite_Connection *self,
/*[clinic end generated code: output=776cd2fd20bfe71f input=4feab80659ffc82b]*/
{
_Py_IDENTIFIER(executemany);
PyObject* cursor = 0;
PyObject* result = 0;

cursor = _PyObject_CallMethodIdNoArgs((PyObject*)self, &PyId_cursor);
PyObject *cursor = pysqlite_connection_cursor_impl(self, NULL);
if (!cursor) {
goto error;
}
Expand Down Expand Up @@ -1501,10 +1497,9 @@ pysqlite_connection_executescript(pysqlite_Connection *self,
/*[clinic end generated code: output=4c4f9d77aa0ae37d input=b27ae5c24ffb8b43]*/
{
_Py_IDENTIFIER(executescript);
PyObject* cursor = 0;
PyObject* result = 0;

cursor = _PyObject_CallMethodIdNoArgs((PyObject*)self, &PyId_cursor);
PyObject *cursor = pysqlite_connection_cursor_impl(self, NULL);
if (!cursor) {
goto error;
}
Expand Down