Skip to content
Merged
Show file tree
Hide file tree
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
Update clinic
  • Loading branch information
Erlend E. Aasland committed Oct 30, 2020
commit 865bc22f4d4fd5922d35b2b4d8552f150e362138
36 changes: 25 additions & 11 deletions Modules/_sqlite/clinic/module.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,36 @@ preserve
[clinic start generated code]*/

PyDoc_STRVAR(pysqlite_complete_statement__doc__,
"complete_statement($module, statement, /)\n"
"complete_statement($module, /, statement)\n"
"--\n"
"\n"
"Checks if a string contains a complete SQL statement. Non-standard.");

#define PYSQLITE_COMPLETE_STATEMENT_METHODDEF \
{"complete_statement", (PyCFunction)pysqlite_complete_statement, METH_O, pysqlite_complete_statement__doc__},
{"complete_statement", (PyCFunction)(void(*)(void))pysqlite_complete_statement, METH_FASTCALL|METH_KEYWORDS, pysqlite_complete_statement__doc__},

static PyObject *
pysqlite_complete_statement_impl(PyObject *module, const char *statement);

static PyObject *
pysqlite_complete_statement(PyObject *module, PyObject *arg)
pysqlite_complete_statement(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"statement", NULL};
static _PyArg_Parser _parser = {NULL, _keywords, "complete_statement", 0};
PyObject *argsbuf[1];
const char *statement;

if (!PyUnicode_Check(arg)) {
_PyArg_BadArgument("complete_statement", "argument", "str", arg);
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!PyUnicode_Check(args[0])) {
_PyArg_BadArgument("complete_statement", "argument 'statement'", "str", args[0]);
goto exit;
}
Py_ssize_t statement_length;
statement = PyUnicode_AsUTF8AndSize(arg, &statement_length);
statement = PyUnicode_AsUTF8AndSize(args[0], &statement_length);
if (statement == NULL) {
goto exit;
}
Expand All @@ -40,26 +47,33 @@ pysqlite_complete_statement(PyObject *module, PyObject *arg)
}

PyDoc_STRVAR(pysqlite_enable_shared_cache__doc__,
"enable_shared_cache($module, enable, /)\n"
"enable_shared_cache($module, /, do_enable)\n"
"--\n"
"\n"
"Enable or disable shared cache mode for the calling thread.\n"
"\n"
"Experimental/Non-standard.");

#define PYSQLITE_ENABLE_SHARED_CACHE_METHODDEF \
{"enable_shared_cache", (PyCFunction)pysqlite_enable_shared_cache, METH_O, pysqlite_enable_shared_cache__doc__},
{"enable_shared_cache", (PyCFunction)(void(*)(void))pysqlite_enable_shared_cache, METH_FASTCALL|METH_KEYWORDS, pysqlite_enable_shared_cache__doc__},

static PyObject *
pysqlite_enable_shared_cache_impl(PyObject *module, int do_enable);

static PyObject *
pysqlite_enable_shared_cache(PyObject *module, PyObject *arg)
pysqlite_enable_shared_cache(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"do_enable", NULL};
static _PyArg_Parser _parser = {NULL, _keywords, "enable_shared_cache", 0};
PyObject *argsbuf[1];
int do_enable;

do_enable = _PyLong_AsInt(arg);
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
do_enable = _PyLong_AsInt(args[0]);
if (do_enable == -1 && PyErr_Occurred()) {
goto exit;
}
Expand Down Expand Up @@ -205,4 +219,4 @@ pysqlite_adapt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
exit:
return return_value;
}
/*[clinic end generated code: output=f56e6c44a21b22f8 input=a9049054013a1b77]*/
/*[clinic end generated code: output=d87990f941c209fa input=a9049054013a1b77]*/
4 changes: 2 additions & 2 deletions Modules/_sqlite/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Checks if a string contains a complete SQL statement. Non-standard.

static PyObject *
pysqlite_complete_statement_impl(PyObject *module, const char *statement)
/*[clinic end generated code: output=e55f1ff1952df558 input=b15b778a9c1b557b]*/
/*[clinic end generated code: output=e55f1ff1952df558 input=f6b24996b31c5c33]*/
{
PyObject* result;

Expand All @@ -145,7 +145,7 @@ Experimental/Non-standard.

static PyObject *
pysqlite_enable_shared_cache_impl(PyObject *module, int do_enable)
/*[clinic end generated code: output=259c74eedee1516b input=6c608c515bd7caba]*/
/*[clinic end generated code: output=259c74eedee1516b input=8400e41bc58b6b24]*/
{
int rc;

Expand Down