set_autocommit() in Modules/_sqlite/connection.c passes the value to autocommit_converter(), which dereferences it in Py_IsTrue().
Deleting row_factory and text_factory of a connection is already rejected with an AttributeError (gh-149738); autocommit should be rejected too.
The same converter has a second bug: autocommit_converter() compares the result of PyLong_AsLong() with LEGACY_TRANSACTION_CONTROL, which is -1, the value returned on error.
cx.autocommit=2**1000
is therefore accepted as LEGACY_TRANSACTION_CONTROL with OverflowError set, and the interpreter continues with a pending exception. GH-156104 fixes both.
Activity
serhiy-storchaka commented on Aug 20, 2026
The same converter has a second bug: autocommit_converter() compares the result of PyLong_AsLong() with LEGACY_TRANSACTION_CONTROL, which is -1, the value returned on error.
is therefore accepted as LEGACY_TRANSACTION_CONTROL with OverflowError set, and the interpreter continues with a pending exception.
GH-156104 fixes both.
gh-156100: Fix crashes in the sqlite3 Connection.autocommit setter (G…
[3.14] gh-156100: Fix crashes in the sqlite3 Connection.autocommit se…
[3.13] gh-156100: Fix crashes in the sqlite3 Connection.autocommit se…
[3.15] gh-156100: Fix crashes in the sqlite3 Connection.autocommit se…