diff --git a/Lib/test/test_audit.py b/Lib/test/test_audit.py index d19068b76e..13874d41db 100644 --- a/Lib/test/test_audit.py +++ b/Lib/test/test_audit.py @@ -158,7 +158,7 @@ def test_sqlite3(self): if support.verbose: print(*events, sep='\n') actual = [ev[0] for ev in events] - expected = ["sqlite3.connect"] + expected = ["sqlite3.connect", "sqlite3.connected"] if hasattr(sqlite3.Connection, "enable_load_extension"): expected += [ "sqlite3.enable_load_extension", diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 04ec47ae17..7d34179ae7 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -168,6 +168,10 @@ pysqlite_connection_init(pysqlite_Connection *self, PyObject *args, return -1; } + if (PySys_Audit("sqlite3.connected", "O", self) < 0) { + return -1; + } + self->Warning = pysqlite_Warning; self->Error = pysqlite_Error; self->InterfaceError = pysqlite_InterfaceError; @@ -1154,7 +1158,8 @@ pysqlite_connection_enable_load_extension_impl(pysqlite_Connection *self, { int rc; - if (PySys_Audit("sqlite3.enable_load_extension", "O", onoff ? Py_True : Py_False) < 0) { + if (PySys_Audit("sqlite3.enable_load_extension", + "OO", self, onoff ? Py_True : Py_False) < 0) { return NULL; } @@ -1189,7 +1194,7 @@ pysqlite_connection_load_extension_impl(pysqlite_Connection *self, int rc; char* errmsg; - if (PySys_Audit("sqlite3.load_extension", "s", extension_name) < 0) { + if (PySys_Audit("sqlite3.load_extension", "Os", self, extension_name) < 0) { return NULL; }