mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
gh-83638: Add sqlite3.Connection.autocommit for PEP 249 compliant behaviour (#93823)
Introduce the autocommit attribute to Connection and the autocommit parameter to connect() for PEP 249-compliant transaction handling. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
This commit is contained in:
parent
99972dc745
commit
c95f554a40
14 changed files with 537 additions and 62 deletions
|
|
@ -46,7 +46,8 @@ module _sqlite3
|
|||
PyDoc_STRVAR(module_connect_doc,
|
||||
"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"
|
||||
"Opens a connection to the SQLite database file database.\n"
|
||||
|
|
@ -706,6 +707,10 @@ module_exec(PyObject *module)
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (PyModule_AddIntMacro(module, LEGACY_TRANSACTION_CONTROL) < 0) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
int threadsafety = get_threadsafety(state);
|
||||
if (threadsafety < 0) {
|
||||
goto error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue