Skip to content

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

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
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
6 changes: 6 additions & 0 deletions Doc/library/sqlite3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,12 @@ Module functions
.. versionadded:: 3.12
The *autocommit* parameter.

.. versionchanged:: 3.13
Positional use of the parameters *timeout*, *detect_types*,
*isolation_level*, *check_same_thread*, *factory*, *cached_statements*,
and *uri* is deprecated.
They will become keyword-only parameters in Python 3.15.

.. function:: complete_statement(statement)

Return ``True`` if the string *statement* appears to contain
Expand Down
15 changes: 15 additions & 0 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ pathlib
:meth:`~pathlib.Path.is_dir`.
(Contributed by Barney Gale in :gh:`77609` and :gh:`105793`.)

sqlite3
-------

* Passing more than one positional argument to :func:`sqlite3.connect` is
deprecated. Parameters *timeout*, *detect_types*, *isolation_level*,
*check_same_thread*, *factory*, *cached_statements*, and *uri* is deprecated.
They will become keyword-only parameters in Python 3.15.
(Contributed by Erlend E. Aasland :gh:`93057`.)

traceback
---------

Expand Down Expand Up @@ -219,6 +228,12 @@ Deprecated
They will be removed in Python 3.15.
(Contributed by Victor Stinner in :gh:`105096`.)

* Passing more than one positional argument to :func:`sqlite3.connect` is
deprecated. Parameters *timeout*, *detect_types*, *isolation_level*,
*check_same_thread*, *factory*, *cached_statements*, and *uri* is deprecated.
They will become keyword-only parameters in Python 3.15.
(Contributed by Erlend E. Aasland :gh:`93057`.)

Pending Removal in Python 3.14
------------------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Passing more than one positional argument to :func:`sqlite3.connect` is
deprecated. Parameters *timeout*, *detect_types*, *isolation_level*,
*check_same_thread*, *factory*, *cached_statements*, and *uri* is
deprecated. They will become keyword-only parameters in Python 3.15. Patch
by Erlend E. Aasland.
10 changes: 8 additions & 2 deletions Modules/_sqlite/clinic/_sqlite3.connect.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 34 additions & 1 deletion Modules/_sqlite/clinic/connection.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Modules/_sqlite/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,10 @@ class sqlite3_int64_converter(CConverter):
/*[python end generated code: output=da39a3ee5e6b4b0d input=dff8760fb1eba6a1]*/

/*[clinic input]
_sqlite3.Connection.__init__ as pysqlite_connection_init
sqlite3.Connection.__init__ as pysqlite_connection_init

database: object
* [from 3.15]
timeout: double = 5.0
detect_types: int = 0
isolation_level: IsolationLevel = ""
Expand All @@ -234,7 +235,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=9b0ab6c12f674fa3]*/
/*[clinic end generated code: output=cba057313ea7712f input=219c3dbecbae7d99]*/
{
if (PySys_Audit("sqlite3.connect", "O", database) < 0) {
return -1;
Expand Down