Skip to content

gh-156100: Fix crashes in the sqlite3 Connection.autocommit setter - #156104

Open
serhiy-storchaka wants to merge 3 commits into
python:mainfrom
serhiy-storchaka:gh-156100-sqlite-autocommit-delete
Open

gh-156100: Fix crashes in the sqlite3 Connection.autocommit setter#156104
serhiy-storchaka wants to merge 3 commits into
python:mainfrom
serhiy-storchaka:gh-156100-sqlite-autocommit-delete

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Aug 20, 2026

Copy link
Copy Markdown
Member

The setter passed the deleted value to autocommit_converter(), which dereferences it in Py_IsTrue().
Deleting the attribute now raises AttributeError, like row_factory and text_factory (gh-149738).

autocommit_converter() also reported success with OverflowError set when the value was an integer which does not fit in C long, because PyLong_AsLong() returns -1 on error, and LEGACY_TRANSACTION_CONTROL is -1.
Such value is now rejected with ValueError, like any other invalid value.

The setter passed the deleted value to autocommit_converter(), which
dereferences it.
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Aug 20, 2026
LEGACY_TRANSACTION_CONTROL is -1, the same value which PyLong_AsLong()
returns on error, so the converter reported success with OverflowError set.
@serhiy-storchaka serhiy-storchaka changed the title gh-156100: Fix a crash when deleting sqlite3 Connection.autocommit gh-156100: Fix crashes in the sqlite3 Connection.autocommit setter Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant