This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [sqlite3] Explicitly initialise and shut down sqlite3
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, erlendaasland, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2021-03-15 23:09 by erlendaasland, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 25404 merged erlendaasland, 2021-04-14 13:29
Messages (4)
msg388788 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-03-15 23:09
We should explicitly initialise (and shut down) the SQLite library in the sqlite3 module. This may be required in future releases:

Quoting from the SQLite docs:
"For maximum portability, it is recommended that applications always invoke sqlite3_initialize() directly prior to using any other SQLite interface. Future releases of SQLite may require this. In other words, the behavior exhibited when SQLite is compiled with SQLITE_OMIT_AUTOINIT might become the default behavior in some future release of SQLite."

Ref.
- https://sqlite.org/c3ref/initialize.html
- https://sqlite.org/compile.html#omit_autoinit
msg391083 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2021-04-14 14:49
Making SQLITE_OMIT_AUTOINIT the default behavior would pretty much break every application that use SQLite, but since the PR is small enough and uses the interface in the correct way, I don't see a strong reason to reject it.
msg391084 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2021-04-14 14:50
New changeset def919342facf7f53a3a5f0e9f4b1889d323956d by Erlend Egeberg Aasland in branch 'master':
bpo-43505: Explicitly initialize and shutdown sqlite3 (GH-25404)
https://github.com/python/cpython/commit/def919342facf7f53a3a5f0e9f4b1889d323956d
msg391085 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-04-14 15:00
> Making SQLITE_OMIT_AUTOINIT the default behavior would pretty much break every application that use SQLite [...]

Yeah, I know, _but_ if some user decides use a SQLite library compiled with SQLITE_OMIT_AUTOINIT (because it is mentioned in the "Recommended Compile-time Optinos"[1]), Python 3.10 won't break :)


[1] https://sqlite.org/compile.html
History
Date User Action Args
2022-04-11 14:59:42adminsetgithub: 87671
2021-04-14 15:00:17erlendaaslandsetmessages: + msg391085
2021-04-14 14:51:02berker.peksagsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-04-14 14:50:24berker.peksagsetmessages: + msg391084
2021-04-14 14:49:02berker.peksagsetmessages: + msg391083
2021-04-14 13:29:32erlendaaslandsetkeywords: + patch
stage: patch review
pull_requests: + pull_request24137
2021-03-15 23:09:44erlendaaslandcreate