Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bpo-40956: Fix sqlite3 AC code #23837

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

Merged
merged 1 commit into from
Dec 18, 2020
Merged
Show file tree
Hide file tree
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
30 changes: 27 additions & 3 deletions Modules/_sqlite/clinic/connection.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,39 @@ pysqlite_connection_set_progress_handler(pysqlite_Connection *self, PyObject *co
}

PyDoc_STRVAR(pysqlite_connection_set_trace_callback__doc__,
"set_trace_callback($self, trace_callback, /)\n"
"set_trace_callback($self, /, trace_callback)\n"
"--\n"
"\n"
"Sets a trace callback called for each SQL statement (passed as unicode).\n"
"\n"
"Non-standard.");

#define PYSQLITE_CONNECTION_SET_TRACE_CALLBACK_METHODDEF \
{"set_trace_callback", (PyCFunction)pysqlite_connection_set_trace_callback, METH_O, pysqlite_connection_set_trace_callback__doc__},
{"set_trace_callback", (PyCFunction)(void(*)(void))pysqlite_connection_set_trace_callback, METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_trace_callback__doc__},

static PyObject *
pysqlite_connection_set_trace_callback_impl(pysqlite_Connection *self,
PyObject *trace_callback);

static PyObject *
pysqlite_connection_set_trace_callback(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"trace_callback", NULL};
static _PyArg_Parser _parser = {NULL, _keywords, "set_trace_callback", 0};
PyObject *argsbuf[1];
PyObject *trace_callback;

args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
trace_callback = args[0];
return_value = pysqlite_connection_set_trace_callback_impl(self, trace_callback);

exit:
return return_value;
}

#if !defined(SQLITE_OMIT_LOAD_EXTENSION)

Expand Down Expand Up @@ -487,4 +511,4 @@ pysqlite_connection_exit(pysqlite_Connection *self, PyObject *const *args, Py_ss
#ifndef PYSQLITE_CONNECTION_LOAD_EXTENSION_METHODDEF
#define PYSQLITE_CONNECTION_LOAD_EXTENSION_METHODDEF
#endif /* !defined(PYSQLITE_CONNECTION_LOAD_EXTENSION_METHODDEF) */
/*[clinic end generated code: output=e14085c0abc0a407 input=a9049054013a1b77]*/
/*[clinic end generated code: output=eb14a52e4c682f3b input=a9049054013a1b77]*/
11 changes: 5 additions & 6 deletions Modules/_sqlite/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,17 +1083,16 @@ pysqlite_connection_set_progress_handler_impl(pysqlite_Connection *self,
_sqlite3.Connection.set_trace_callback as pysqlite_connection_set_trace_callback

trace_callback: object
/

Sets a trace callback called for each SQL statement (passed as unicode).

Non-standard.
[clinic start generated code]*/

static PyObject *
pysqlite_connection_set_trace_callback(pysqlite_Connection *self,
PyObject *trace_callback)
/*[clinic end generated code: output=efd1bf439e81696c input=05a4a14360e0e034]*/
pysqlite_connection_set_trace_callback_impl(pysqlite_Connection *self,
PyObject *trace_callback)
/*[clinic end generated code: output=fb0e307b9924d454 input=56d60fd38d763679]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
Expand Down Expand Up @@ -1130,7 +1129,7 @@ pysqlite_connection_set_trace_callback(pysqlite_Connection *self,
/*[clinic input]
_sqlite3.Connection.enable_load_extension as pysqlite_connection_enable_load_extension

enable as onoff: int
enable as onoff: bool(accept={int})
/

Enable dynamic loading of SQLite extension modules. Non-standard.
Expand All @@ -1139,7 +1138,7 @@ Enable dynamic loading of SQLite extension modules. Non-standard.
static PyObject *
pysqlite_connection_enable_load_extension_impl(pysqlite_Connection *self,
int onoff)
/*[clinic end generated code: output=9cac37190d388baf input=7df2986f1602d6bd]*/
/*[clinic end generated code: output=9cac37190d388baf input=5c0da5b121121cbc]*/
{
int rc;

Expand Down