aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Modules/_sqlite
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_sqlite')
-rw-r--r--Modules/_sqlite/clinic/_sqlite3.connect.c.h14
-rw-r--r--Modules/_sqlite/clinic/connection.c.h279
-rw-r--r--Modules/_sqlite/connection.c27
-rw-r--r--Modules/_sqlite/module.c22
4 files changed, 62 insertions, 280 deletions
diff --git a/Modules/_sqlite/clinic/_sqlite3.connect.c.h b/Modules/_sqlite/clinic/_sqlite3.connect.c.h
index 1bcda7702c2..e9d560666c1 100644
--- a/Modules/_sqlite/clinic/_sqlite3.connect.c.h
+++ b/Modules/_sqlite/clinic/_sqlite3.connect.c.h
@@ -9,23 +9,17 @@ preserve
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
PyDoc_STRVAR(pysqlite_connect__doc__,
-"connect($module, /, database, timeout=5.0, detect_types=0,\n"
+"connect($module, /, database, *, timeout=5.0, detect_types=0,\n"
" isolation_level=\'\', check_same_thread=True,\n"
-" factory=ConnectionType, cached_statements=128, uri=False, *,\n"
+" factory=ConnectionType, cached_statements=128, uri=False,\n"
" autocommit=sqlite3.LEGACY_TRANSACTION_CONTROL)\n"
"--\n"
"\n"
"Open a connection to the SQLite database file \'database\'.\n"
"\n"
"You can use \":memory:\" to open a database connection to a database that\n"
-"resides in RAM instead of on disk.\n"
-"\n"
-"Note: Passing more than 1 positional argument to _sqlite3.connect() is\n"
-"deprecated. Parameters \'timeout\', \'detect_types\', \'isolation_level\',\n"
-"\'check_same_thread\', \'factory\', \'cached_statements\' and \'uri\' will\n"
-"become keyword-only parameters in Python 3.15.\n"
-"");
+"resides in RAM instead of on disk.");
#define PYSQLITE_CONNECT_METHODDEF \
{"connect", _PyCFunction_CAST(pysqlite_connect), METH_FASTCALL|METH_KEYWORDS, pysqlite_connect__doc__},
-/*[clinic end generated code: output=69b9b00da71c3c0a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3d83139ba65e0bb5 input=a9049054013a1b77]*/
diff --git a/Modules/_sqlite/clinic/connection.c.h b/Modules/_sqlite/clinic/connection.c.h
index c8e1d0b7a73..f0e9fdb8894 100644
--- a/Modules/_sqlite/clinic/connection.c.h
+++ b/Modules/_sqlite/clinic/connection.c.h
@@ -16,17 +16,6 @@ pysqlite_connection_init_impl(pysqlite_Connection *self, PyObject *database,
int cache_size, int uri,
enum autocommit_mode autocommit);
-// Emit compiler warnings when we get to Python 3.15.
-#if PY_VERSION_HEX >= 0x030f00C0
-# error "Update the clinic input of '_sqlite3.Connection.__init__'."
-#elif PY_VERSION_HEX >= 0x030f00A0
-# ifdef _MSC_VER
-# pragma message ("Update the clinic input of '_sqlite3.Connection.__init__'.")
-# else
-# warning "Update the clinic input of '_sqlite3.Connection.__init__'."
-# endif
-#endif
-
static int
pysqlite_connection_init(PyObject *self, PyObject *args, PyObject *kwargs)
{
@@ -72,25 +61,14 @@ pysqlite_connection_init(PyObject *self, PyObject *args, PyObject *kwargs)
int uri = 0;
enum autocommit_mode autocommit = LEGACY_TRANSACTION_CONTROL;
- if (nargs > 1 && nargs <= 8) {
- if (PyErr_WarnEx(PyExc_DeprecationWarning,
- "Passing more than 1 positional argument to _sqlite3.Connection()"
- " is deprecated. Parameters 'timeout', 'detect_types', "
- "'isolation_level', 'check_same_thread', 'factory', "
- "'cached_statements' and 'uri' will become keyword-only "
- "parameters in Python 3.15.", 1))
- {
- goto exit;
- }
- }
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser,
- /*minpos*/ 1, /*maxpos*/ 8, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
+ /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
if (!fastargs) {
goto exit;
}
database = fastargs[0];
if (!noptargs) {
- goto skip_optional_pos;
+ goto skip_optional_kwonly;
}
if (fastargs[1]) {
if (PyFloat_CheckExact(fastargs[1])) {
@@ -104,7 +82,7 @@ pysqlite_connection_init(PyObject *self, PyObject *args, PyObject *kwargs)
}
}
if (!--noptargs) {
- goto skip_optional_pos;
+ goto skip_optional_kwonly;
}
}
if (fastargs[2]) {
@@ -113,7 +91,7 @@ pysqlite_connection_init(PyObject *self, PyObject *args, PyObject *kwargs)
goto exit;
}
if (!--noptargs) {
- goto skip_optional_pos;
+ goto skip_optional_kwonly;
}
}
if (fastargs[3]) {
@@ -121,7 +99,7 @@ pysqlite_connection_init(PyObject *self, PyObject *args, PyObject *kwargs)
goto exit;
}
if (!--noptargs) {
- goto skip_optional_pos;
+ goto skip_optional_kwonly;
}
}
if (fastargs[4]) {
@@ -130,13 +108,13 @@ pysqlite_connection_init(PyObject *self, PyObject *args, PyObject *kwargs)
goto exit;
}
if (!--noptargs) {
- goto skip_optional_pos;
+ goto skip_optional_kwonly;
}
}
if (fastargs[5]) {
factory = fastargs[5];
if (!--noptargs) {
- goto skip_optional_pos;
+ goto skip_optional_kwonly;
}
}
if (fastargs[6]) {
@@ -145,7 +123,7 @@ pysqlite_connection_init(PyObject *self, PyObject *args, PyObject *kwargs)
goto exit;
}
if (!--noptargs) {
- goto skip_optional_pos;
+ goto skip_optional_kwonly;
}
}
if (fastargs[7]) {
@@ -154,13 +132,9 @@ pysqlite_connection_init(PyObject *self, PyObject *args, PyObject *kwargs)
goto exit;
}
if (!--noptargs) {
- goto skip_optional_pos;
+ goto skip_optional_kwonly;
}
}
-skip_optional_pos:
- if (!noptargs) {
- goto skip_optional_kwonly;
- }
if (!autocommit_converter(fastargs[8], &autocommit)) {
goto exit;
}
@@ -424,15 +398,10 @@ pysqlite_connection_rollback(PyObject *self, PyObject *Py_UNUSED(ignored))
}
PyDoc_STRVAR(pysqlite_connection_create_function__doc__,
-"create_function($self, /, name, narg, func, *, deterministic=False)\n"
+"create_function($self, name, narg, func, /, *, deterministic=False)\n"
"--\n"
"\n"
-"Creates a new function.\n"
-"\n"
-"Note: Passing keyword arguments \'name\', \'narg\' and \'func\' to\n"
-"_sqlite3.Connection.create_function() is deprecated. Parameters\n"
-"\'name\', \'narg\' and \'func\' will become positional-only in Python 3.15.\n"
-"");
+"Creates a new function.");
#define PYSQLITE_CONNECTION_CREATE_FUNCTION_METHODDEF \
{"create_function", _PyCFunction_CAST(pysqlite_connection_create_function), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_create_function__doc__},
@@ -443,24 +412,13 @@ pysqlite_connection_create_function_impl(pysqlite_Connection *self,
int narg, PyObject *func,
int deterministic);
-// Emit compiler warnings when we get to Python 3.15.
-#if PY_VERSION_HEX >= 0x030f00C0
-# error "Update the clinic input of '_sqlite3.Connection.create_function'."
-#elif PY_VERSION_HEX >= 0x030f00A0
-# ifdef _MSC_VER
-# pragma message ("Update the clinic input of '_sqlite3.Connection.create_function'.")
-# else
-# warning "Update the clinic input of '_sqlite3.Connection.create_function'."
-# endif
-#endif
-
static PyObject *
pysqlite_connection_create_function(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 4
+ #define NUM_KEYWORDS 1
static struct {
PyGC_Head _this_is_not_used;
PyObject_VAR_HEAD
@@ -469,7 +427,7 @@ pysqlite_connection_create_function(PyObject *self, PyTypeObject *cls, PyObject
} _kwtuple = {
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
.ob_hash = -1,
- .ob_item = { &_Py_ID(name), &_Py_ID(narg), &_Py_ID(func), &_Py_ID(deterministic), },
+ .ob_item = { &_Py_ID(deterministic), },
};
#undef NUM_KEYWORDS
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
@@ -478,7 +436,7 @@ pysqlite_connection_create_function(PyObject *self, PyTypeObject *cls, PyObject
# define KWTUPLE NULL
#endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"name", "narg", "func", "deterministic", NULL};
+ static const char * const _keywords[] = {"", "", "", "deterministic", NULL};
static _PyArg_Parser _parser = {
.keywords = _keywords,
.fname = "create_function",
@@ -497,18 +455,8 @@ pysqlite_connection_create_function(PyObject *self, PyTypeObject *cls, PyObject
if (!args) {
goto exit;
}
- if (nargs < 3) {
- if (PyErr_WarnEx(PyExc_DeprecationWarning,
- "Passing keyword arguments 'name', 'narg' and 'func' to "
- "_sqlite3.Connection.create_function() is deprecated. Parameters "
- "'name', 'narg' and 'func' will become positional-only in Python "
- "3.15.", 1))
- {
- goto exit;
- }
- }
if (!PyUnicode_Check(args[0])) {
- _PyArg_BadArgument("create_function", "argument 'name'", "str", args[0]);
+ _PyArg_BadArgument("create_function", "argument 1", "str", args[0]);
goto exit;
}
Py_ssize_t name_length;
@@ -618,16 +566,10 @@ exit:
#endif /* defined(HAVE_WINDOW_FUNCTIONS) */
PyDoc_STRVAR(pysqlite_connection_create_aggregate__doc__,
-"create_aggregate($self, /, name, n_arg, aggregate_class)\n"
+"create_aggregate($self, name, n_arg, aggregate_class, /)\n"
"--\n"
"\n"
-"Creates a new aggregate.\n"
-"\n"
-"Note: Passing keyword arguments \'name\', \'n_arg\' and \'aggregate_class\'\n"
-"to _sqlite3.Connection.create_aggregate() is deprecated. Parameters\n"
-"\'name\', \'n_arg\' and \'aggregate_class\' will become positional-only in\n"
-"Python 3.15.\n"
-"");
+"Creates a new aggregate.");
#define PYSQLITE_CONNECTION_CREATE_AGGREGATE_METHODDEF \
{"create_aggregate", _PyCFunction_CAST(pysqlite_connection_create_aggregate), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_create_aggregate__doc__},
@@ -638,42 +580,17 @@ pysqlite_connection_create_aggregate_impl(pysqlite_Connection *self,
const char *name, int n_arg,
PyObject *aggregate_class);
-// Emit compiler warnings when we get to Python 3.15.
-#if PY_VERSION_HEX >= 0x030f00C0
-# error "Update the clinic input of '_sqlite3.Connection.create_aggregate'."
-#elif PY_VERSION_HEX >= 0x030f00A0
-# ifdef _MSC_VER
-# pragma message ("Update the clinic input of '_sqlite3.Connection.create_aggregate'.")
-# else
-# warning "Update the clinic input of '_sqlite3.Connection.create_aggregate'."
-# endif
-#endif
-
static PyObject *
pysqlite_connection_create_aggregate(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
-
- #define NUM_KEYWORDS 3
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- Py_hash_t ob_hash;
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_hash = -1,
- .ob_item = { &_Py_ID(name), &_Py_ID(n_arg), &_Py_ID(aggregate_class), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
-
- #else // !Py_BUILD_CORE
+ # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
+ #else
# define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
+ #endif
- static const char * const _keywords[] = {"name", "n_arg", "aggregate_class", NULL};
+ static const char * const _keywords[] = {"", "", "", NULL};
static _PyArg_Parser _parser = {
.keywords = _keywords,
.fname = "create_aggregate",
@@ -690,18 +607,8 @@ pysqlite_connection_create_aggregate(PyObject *self, PyTypeObject *cls, PyObject
if (!args) {
goto exit;
}
- if (nargs < 3) {
- if (PyErr_WarnEx(PyExc_DeprecationWarning,
- "Passing keyword arguments 'name', 'n_arg' and 'aggregate_class' "
- "to _sqlite3.Connection.create_aggregate() is deprecated. "
- "Parameters 'name', 'n_arg' and 'aggregate_class' will become "
- "positional-only in Python 3.15.", 1))
- {
- goto exit;
- }
- }
if (!PyUnicode_Check(args[0])) {
- _PyArg_BadArgument("create_aggregate", "argument 'name'", "str", args[0]);
+ _PyArg_BadArgument("create_aggregate", "argument 1", "str", args[0]);
goto exit;
}
Py_ssize_t name_length;
@@ -725,15 +632,10 @@ exit:
}
PyDoc_STRVAR(pysqlite_connection_set_authorizer__doc__,
-"set_authorizer($self, /, authorizer_callback)\n"
+"set_authorizer($self, authorizer_callback, /)\n"
"--\n"
"\n"
-"Set authorizer callback.\n"
-"\n"
-"Note: Passing keyword argument \'authorizer_callback\' to\n"
-"_sqlite3.Connection.set_authorizer() is deprecated. Parameter\n"
-"\'authorizer_callback\' will become positional-only in Python 3.15.\n"
-"");
+"Set authorizer callback.");
#define PYSQLITE_CONNECTION_SET_AUTHORIZER_METHODDEF \
{"set_authorizer", _PyCFunction_CAST(pysqlite_connection_set_authorizer), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_authorizer__doc__},
@@ -743,42 +645,17 @@ pysqlite_connection_set_authorizer_impl(pysqlite_Connection *self,
PyTypeObject *cls,
PyObject *callable);
-// Emit compiler warnings when we get to Python 3.15.
-#if PY_VERSION_HEX >= 0x030f00C0
-# error "Update the clinic input of '_sqlite3.Connection.set_authorizer'."
-#elif PY_VERSION_HEX >= 0x030f00A0
-# ifdef _MSC_VER
-# pragma message ("Update the clinic input of '_sqlite3.Connection.set_authorizer'.")
-# else
-# warning "Update the clinic input of '_sqlite3.Connection.set_authorizer'."
-# endif
-#endif
-
static PyObject *
pysqlite_connection_set_authorizer(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
-
- #define NUM_KEYWORDS 1
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- Py_hash_t ob_hash;
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_hash = -1,
- .ob_item = { &_Py_ID(authorizer_callback), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
-
- #else // !Py_BUILD_CORE
+ # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
+ #else
# define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
+ #endif
- static const char * const _keywords[] = {"authorizer_callback", NULL};
+ static const char * const _keywords[] = {"", NULL};
static _PyArg_Parser _parser = {
.keywords = _keywords,
.fname = "set_authorizer",
@@ -793,16 +670,6 @@ pysqlite_connection_set_authorizer(PyObject *self, PyTypeObject *cls, PyObject *
if (!args) {
goto exit;
}
- if (nargs < 1) {
- if (PyErr_WarnEx(PyExc_DeprecationWarning,
- "Passing keyword argument 'authorizer_callback' to "
- "_sqlite3.Connection.set_authorizer() is deprecated. Parameter "
- "'authorizer_callback' will become positional-only in Python "
- "3.15.", 1))
- {
- goto exit;
- }
- }
callable = args[0];
return_value = pysqlite_connection_set_authorizer_impl((pysqlite_Connection *)self, cls, callable);
@@ -811,7 +678,7 @@ exit:
}
PyDoc_STRVAR(pysqlite_connection_set_progress_handler__doc__,
-"set_progress_handler($self, /, progress_handler, n)\n"
+"set_progress_handler($self, progress_handler, /, n)\n"
"--\n"
"\n"
"Set progress handler callback.\n"
@@ -824,12 +691,7 @@ PyDoc_STRVAR(pysqlite_connection_set_progress_handler__doc__,
" The number of SQLite virtual machine instructions that are\n"
" executed between invocations of \'progress_handler\'.\n"
"\n"
-"If \'progress_handler\' is None or \'n\' is 0, the progress handler is disabled.\n"
-"\n"
-"Note: Passing keyword argument \'progress_handler\' to\n"
-"_sqlite3.Connection.set_progress_handler() is deprecated. Parameter\n"
-"\'progress_handler\' will become positional-only in Python 3.15.\n"
-"");
+"If \'progress_handler\' is None or \'n\' is 0, the progress handler is disabled.");
#define PYSQLITE_CONNECTION_SET_PROGRESS_HANDLER_METHODDEF \
{"set_progress_handler", _PyCFunction_CAST(pysqlite_connection_set_progress_handler), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_progress_handler__doc__},
@@ -839,24 +701,13 @@ pysqlite_connection_set_progress_handler_impl(pysqlite_Connection *self,
PyTypeObject *cls,
PyObject *callable, int n);
-// Emit compiler warnings when we get to Python 3.15.
-#if PY_VERSION_HEX >= 0x030f00C0
-# error "Update the clinic input of '_sqlite3.Connection.set_progress_handler'."
-#elif PY_VERSION_HEX >= 0x030f00A0
-# ifdef _MSC_VER
-# pragma message ("Update the clinic input of '_sqlite3.Connection.set_progress_handler'.")
-# else
-# warning "Update the clinic input of '_sqlite3.Connection.set_progress_handler'."
-# endif
-#endif
-
static PyObject *
pysqlite_connection_set_progress_handler(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 2
+ #define NUM_KEYWORDS 1
static struct {
PyGC_Head _this_is_not_used;
PyObject_VAR_HEAD
@@ -865,7 +716,7 @@ pysqlite_connection_set_progress_handler(PyObject *self, PyTypeObject *cls, PyOb
} _kwtuple = {
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
.ob_hash = -1,
- .ob_item = { &_Py_ID(progress_handler), _Py_LATIN1_CHR('n'), },
+ .ob_item = { _Py_LATIN1_CHR('n'), },
};
#undef NUM_KEYWORDS
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
@@ -874,7 +725,7 @@ pysqlite_connection_set_progress_handler(PyObject *self, PyTypeObject *cls, PyOb
# define KWTUPLE NULL
#endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"progress_handler", "n", NULL};
+ static const char * const _keywords[] = {"", "n", NULL};
static _PyArg_Parser _parser = {
.keywords = _keywords,
.fname = "set_progress_handler",
@@ -890,16 +741,6 @@ pysqlite_connection_set_progress_handler(PyObject *self, PyTypeObject *cls, PyOb
if (!args) {
goto exit;
}
- if (nargs < 1) {
- if (PyErr_WarnEx(PyExc_DeprecationWarning,
- "Passing keyword argument 'progress_handler' to "
- "_sqlite3.Connection.set_progress_handler() is deprecated. "
- "Parameter 'progress_handler' will become positional-only in "
- "Python 3.15.", 1))
- {
- goto exit;
- }
- }
callable = args[0];
n = PyLong_AsInt(args[1]);
if (n == -1 && PyErr_Occurred()) {
@@ -912,15 +753,10 @@ exit:
}
PyDoc_STRVAR(pysqlite_connection_set_trace_callback__doc__,
-"set_trace_callback($self, /, trace_callback)\n"
+"set_trace_callback($self, trace_callback, /)\n"
"--\n"
"\n"
-"Set a trace callback called for each SQL statement (passed as unicode).\n"
-"\n"
-"Note: Passing keyword argument \'trace_callback\' to\n"
-"_sqlite3.Connection.set_trace_callback() is deprecated. Parameter\n"
-"\'trace_callback\' will become positional-only in Python 3.15.\n"
-"");
+"Set a trace callback called for each SQL statement (passed as unicode).");
#define PYSQLITE_CONNECTION_SET_TRACE_CALLBACK_METHODDEF \
{"set_trace_callback", _PyCFunction_CAST(pysqlite_connection_set_trace_callback), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_trace_callback__doc__},
@@ -930,42 +766,17 @@ pysqlite_connection_set_trace_callback_impl(pysqlite_Connection *self,
PyTypeObject *cls,
PyObject *callable);
-// Emit compiler warnings when we get to Python 3.15.
-#if PY_VERSION_HEX >= 0x030f00C0
-# error "Update the clinic input of '_sqlite3.Connection.set_trace_callback'."
-#elif PY_VERSION_HEX >= 0x030f00A0
-# ifdef _MSC_VER
-# pragma message ("Update the clinic input of '_sqlite3.Connection.set_trace_callback'.")
-# else
-# warning "Update the clinic input of '_sqlite3.Connection.set_trace_callback'."
-# endif
-#endif
-
static PyObject *
pysqlite_connection_set_trace_callback(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
-
- #define NUM_KEYWORDS 1
- static struct {
- PyGC_Head _this_is_not_used;
- PyObject_VAR_HEAD
- Py_hash_t ob_hash;
- PyObject *ob_item[NUM_KEYWORDS];
- } _kwtuple = {
- .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
- .ob_hash = -1,
- .ob_item = { &_Py_ID(trace_callback), },
- };
- #undef NUM_KEYWORDS
- #define KWTUPLE (&_kwtuple.ob_base.ob_base)
-
- #else // !Py_BUILD_CORE
+ # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
+ #else
# define KWTUPLE NULL
- #endif // !Py_BUILD_CORE
+ #endif
- static const char * const _keywords[] = {"trace_callback", NULL};
+ static const char * const _keywords[] = {"", NULL};
static _PyArg_Parser _parser = {
.keywords = _keywords,
.fname = "set_trace_callback",
@@ -980,16 +791,6 @@ pysqlite_connection_set_trace_callback(PyObject *self, PyTypeObject *cls, PyObje
if (!args) {
goto exit;
}
- if (nargs < 1) {
- if (PyErr_WarnEx(PyExc_DeprecationWarning,
- "Passing keyword argument 'trace_callback' to "
- "_sqlite3.Connection.set_trace_callback() is deprecated. "
- "Parameter 'trace_callback' will become positional-only in Python"
- " 3.15.", 1))
- {
- goto exit;
- }
- }
callable = args[0];
return_value = pysqlite_connection_set_trace_callback_impl((pysqlite_Connection *)self, cls, callable);
@@ -1921,4 +1722,4 @@ exit:
#ifndef DESERIALIZE_METHODDEF
#define DESERIALIZE_METHODDEF
#endif /* !defined(DESERIALIZE_METHODDEF) */
-/*[clinic end generated code: output=2f325c2444b4bb47 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=6cb96e557133d553 input=a9049054013a1b77]*/
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index 2a184f78754..16ec6efc850 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -215,7 +215,7 @@ class sqlite3_int64_converter(CConverter):
_sqlite3.Connection.__init__ as pysqlite_connection_init
database: object
- * [from 3.15]
+ *
timeout: double = 5.0
detect_types: int = 0
isolation_level: IsolationLevel = ""
@@ -223,7 +223,6 @@ _sqlite3.Connection.__init__ as pysqlite_connection_init
factory: object(c_default='(PyObject*)clinic_state()->ConnectionType') = ConnectionType
cached_statements as cache_size: int = 128
uri: bool = False
- *
autocommit: Autocommit(c_default='LEGACY_TRANSACTION_CONTROL') = sqlite3.LEGACY_TRANSACTION_CONTROL
[clinic start generated code]*/
@@ -234,7 +233,7 @@ pysqlite_connection_init_impl(pysqlite_Connection *self, PyObject *database,
int check_same_thread, PyObject *factory,
int cache_size, int uri,
enum autocommit_mode autocommit)
-/*[clinic end generated code: output=cba057313ea7712f input=219c3dbecbae7d99]*/
+/*[clinic end generated code: output=cba057313ea7712f input=5ca4883d8747a49b]*/
{
if (PySys_Audit("sqlite3.connect", "O", database) < 0) {
return -1;
@@ -1158,11 +1157,10 @@ check_num_params(pysqlite_Connection *self, const int n, const char *name)
_sqlite3.Connection.create_function as pysqlite_connection_create_function
cls: defining_class
- /
name: str
narg: int
func: object
- / [from 3.15]
+ /
*
deterministic: bool = False
@@ -1174,7 +1172,7 @@ pysqlite_connection_create_function_impl(pysqlite_Connection *self,
PyTypeObject *cls, const char *name,
int narg, PyObject *func,
int deterministic)
-/*[clinic end generated code: output=8a811529287ad240 input=c7c313b0ca8b519e]*/
+/*[clinic end generated code: output=8a811529287ad240 input=a896096ed5390ae1]*/
{
int rc;
int flags = SQLITE_UTF8;
@@ -1366,11 +1364,10 @@ create_window_function_impl(pysqlite_Connection *self, PyTypeObject *cls,
_sqlite3.Connection.create_aggregate as pysqlite_connection_create_aggregate
cls: defining_class
- /
name: str
n_arg: int
aggregate_class: object
- / [from 3.15]
+ /
Creates a new aggregate.
[clinic start generated code]*/
@@ -1380,7 +1377,7 @@ pysqlite_connection_create_aggregate_impl(pysqlite_Connection *self,
PyTypeObject *cls,
const char *name, int n_arg,
PyObject *aggregate_class)
-/*[clinic end generated code: output=1b02d0f0aec7ff96 input=8087056db6eae1cf]*/
+/*[clinic end generated code: output=1b02d0f0aec7ff96 input=aa2773f6a42f7e17]*/
{
int rc;
@@ -1531,7 +1528,7 @@ _sqlite3.Connection.set_authorizer as pysqlite_connection_set_authorizer
cls: defining_class
authorizer_callback as callable: object
- / [from 3.15]
+ /
Set authorizer callback.
[clinic start generated code]*/
@@ -1540,7 +1537,7 @@ static PyObject *
pysqlite_connection_set_authorizer_impl(pysqlite_Connection *self,
PyTypeObject *cls,
PyObject *callable)
-/*[clinic end generated code: output=75fa60114fc971c3 input=a52bd4937c588752]*/
+/*[clinic end generated code: output=75fa60114fc971c3 input=e76469ab0bb1bbcd]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
@@ -1576,7 +1573,7 @@ _sqlite3.Connection.set_progress_handler as pysqlite_connection_set_progress_han
A callable that takes no arguments.
If the callable returns non-zero, the current query is terminated,
and an exception is raised.
- / [from 3.15]
+ /
n: int
The number of SQLite virtual machine instructions that are
executed between invocations of 'progress_handler'.
@@ -1590,7 +1587,7 @@ static PyObject *
pysqlite_connection_set_progress_handler_impl(pysqlite_Connection *self,
PyTypeObject *cls,
PyObject *callable, int n)
-/*[clinic end generated code: output=0739957fd8034a50 input=b4d6e2ef8b4d32f9]*/
+/*[clinic end generated code: output=0739957fd8034a50 input=74c943f1ae7d8880]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
@@ -1617,7 +1614,7 @@ _sqlite3.Connection.set_trace_callback as pysqlite_connection_set_trace_callback
cls: defining_class
trace_callback as callable: object
- / [from 3.15]
+ /
Set a trace callback called for each SQL statement (passed as unicode).
[clinic start generated code]*/
@@ -1626,7 +1623,7 @@ static PyObject *
pysqlite_connection_set_trace_callback_impl(pysqlite_Connection *self,
PyTypeObject *cls,
PyObject *callable)
-/*[clinic end generated code: output=d91048c03bfcee05 input=d705d592ec03cf28]*/
+/*[clinic end generated code: output=d91048c03bfcee05 input=f4f59bf2f87f2026]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c
index 27e8dab92e0..909ddd1f990 100644
--- a/Modules/_sqlite/module.c
+++ b/Modules/_sqlite/module.c
@@ -60,26 +60,16 @@ pysqlite_connect(PyObject *module, PyObject *const *args, Py_ssize_t nargsf,
pysqlite_state *state = pysqlite_get_state(module);
PyObject *factory = (PyObject *)state->ConnectionType;
- static const int FACTORY_POS = 5;
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
- if (nargs > 1 && nargs <= 8) {
- if (PyErr_WarnEx(PyExc_DeprecationWarning,
- "Passing more than 1 positional argument to sqlite3.connect()"
- " is deprecated. Parameters 'timeout', 'detect_types', "
- "'isolation_level', 'check_same_thread', 'factory', "
- "'cached_statements' and 'uri' will become keyword-only "
- "parameters in Python 3.15.", 1))
- {
- return NULL;
- }
- }
- if (nargs > FACTORY_POS) {
- factory = args[FACTORY_POS];
+ if (nargs > 1) {
+ PyErr_Format(PyExc_TypeError,
+ "connect() takes at most 1 positional arguments (%zd given)", nargs);
+ return NULL;
}
- else if (kwnames != NULL) {
+ if (kwnames != NULL) {
for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(kwnames); i++) {
PyObject *item = PyTuple_GET_ITEM(kwnames, i); // borrowed ref.
- if (PyUnicode_CompareWithASCIIString(item, "factory") == 0) {
+ if (PyUnicode_EqualToUTF8(item, "factory")) {
factory = args[nargs + i];
break;
}