8000 bpo-42064: Optimise `sqlite3` state access, part 1 by erlend-aasland · Pull Request #27273 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-42064: Optimise sqlite3 state access, part 1 #27273

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 6 commits into from
Jul 29, 2021
Merged
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
Update clinic
  • Loading branch information
Erlend E. Aasland committed Jul 27, 2021
commit 5f54745e6f2c2d16aa2b128a82fa6514c1898cc4
24 changes: 15 additions & 9 deletions Modules/_sqlite/clinic/connection.c.h
42BC
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,31 @@ PyDoc_STRVAR(pysqlite_connection_cursor__doc__,
"Return a cursor for the connection.");

#define PYSQLITE_CONNECTION_CURSOR_METHODDEF \
{"cursor", (PyCFunction)(void(*)(void))pysqlite_connection_cursor, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_cursor__doc__},
{"cursor", (PyCFunction)(void(*)(void))pysqlite_connection_cursor, METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_cursor__doc__},

static PyObject *
pysqlite_connection_cursor_impl(pysqlite_Connection *self, PyTypeObject *cls,
PyObject *factory);
pysqlite_connection_cursor_impl(pysqlite_Connection *self, PyObject *factory);

static PyObject *
pysqlite_connection_cursor(pysqlite_Connection *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
pysqlite_connection_cursor(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"factory", NULL};
static _PyArg_Parser _parser = {"|O:cursor", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "cursor", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *factory = NULL;

if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&factory)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
return_value = pysqlite_connection_cursor_impl(self, cls, factory);
if (!noptargs) {
goto skip_optional_pos;
}
factory = args[0];
skip_optional_pos:
return_value = pysqlite_connection_cursor_impl(self, factory);

exit:
return return_value;
Expand Down Expand Up @@ -805,4 +811,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=b81bc52da6810c0e input=a9049054013a1b77]*/
/*[clinic end generated code: output=30f11f2d8f09bdf0 input=a9049054013a1b77]*/
0