gh-93057: Deprecate positional use of optional sqlite3.connect() params (#107948)

This commit is contained in:
Erlend E. Aasland 2023-08-15 10:09:56 +02:00 committed by GitHub
parent a482e5bf00
commit 13c36dc9ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 92 additions and 5 deletions

View file

@ -64,6 +64,17 @@ pysqlite_connect(PyObject *module, PyObject *const *args, Py_ssize_t nargsf,
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];
}