You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Align sqlite3 autocommit transaction handling with CPython #8258
RustPython exposes the three Connection.autocommit modes, but autocommit=False does not follow CPython's transaction lifecycle. A connection does not enter a transaction immediately, and commit() and rollback() do not open a new transaction afterward. Closing a connection and running executescript() also do not consistently preserve the selected mode.
CPython keeps a transaction open for autocommit=False, reopens one after commit() or rollback(), rolls back a pending transaction on close, and preserves the behavior of the True, False, and legacy modes in context managers, DML execution, and executescript().
This leaves six tests in Lib/test/test_sqlite3/test_transactions.py marked as expected failures. Invalid autocommit value validation is outside this scope.
Python Documentation or reference to CPython source code
changed the title [-]Align sqlite3 transaction handling for autocommit=False with CPython[/-][+]Align sqlite3 autocommit transaction handling with CPython[/+]on Jul 27, 2026
The first pull request will align the autocommit=False connection lifecycle by opening a transaction when the connection is created, reopening one after commit() or rollback(), rolling back pending changes on close, and preserving the same behavior in context managers.
The second pull request will address cursor transaction control in execute(), executemany(), and executescript() after additional validation.
Activity
teddygood commentedon Jul 11, 2026
take
[-]Align sqlite3 transaction handling for autocommit=False with CPython[/-][+]Align sqlite3 autocommit transaction handling with CPython[/+]teddygood commentedon Jul 27, 2026
I plan to split this work into two pull requests:
The first pull request will align the
autocommit=Falseconnection lifecycle by opening a transaction when the connection is created, reopening one aftercommit()orrollback(), rolling back pending changes on close, and preserving the same behavior in context managers.The second pull request will address cursor transaction control in
execute(),executemany(), andexecutescript()after additional validation.